<?php

/*
 * NicheBase Theme's Functions
 * Author & Copyright: NicheBase
 * URL: https://nicheaddons.com/
 */
// Initialize Freemius Code

if ( !function_exists( 'nic_fs' ) ) {
    // Create a helper function for easy SDK access.
    function nic_fs()
    {
        global  $nic_fs ;
        
        if ( !isset( $nic_fs ) ) {
            // Include Freemius SDK.
            require_once dirname( __FILE__ ) . '/freemius/start.php';
            $nic_fs = fs_dynamic_init( array(
                'id'             => '5740',
                'slug'           => 'nichebase',
                'premium_slug'   => 'nichebase-pro',
                'type'           => 'theme',
                'public_key'     => 'pk_7f5937f4e4d9845b42ce37579b3a9',
                'is_premium'     => false,
                'premium_suffix' => 'Pro',
                'has_addons'     => false,
                'has_paid_plans' => true,
                'trial'          => array(
                'days'               => 7,
                'is_require_payment' => true,
            ),
                'menu'           => array(
                'slug'    => 'NicheBase',
                'support' => false,
            ),
                'is_live'        => true,
            ) );
        }
        
        return $nic_fs;
    }
    
    // Init Freemius.
    nic_fs();
    // Signal that SDK was initiated.
    do_action( 'nic_fs_loaded' );
}

/**
 * Define - Folder Paths
 */
define( 'NICHEBASE_THEMEROOT_PATH', get_template_directory() );
define( 'NICHEBASE_THEMEROOT_URI', get_template_directory_uri() );
define( 'NICHEBASE_CSS', NICHEBASE_THEMEROOT_URI . '/assets/css' );
define( 'NICHEBASE_IMAGES', NICHEBASE_THEMEROOT_URI . '/assets/images' );
define( 'NICHEBASE_SCRIPTS', NICHEBASE_THEMEROOT_URI . '/assets/js' );
define( 'NICHEBASE_FRAMEWORK', get_template_directory() . '/inc' );
define( 'NICHEBASE_LAYOUT', get_template_directory() . '/template-parts' );
define( 'NICHEBASE_CS_IMAGES', NICHEBASE_THEMEROOT_URI . '/inc/images' );
/**
 * Define - Global Theme Info's
 */

if ( is_child_theme() ) {
    // If Child Theme Active
    $nichebase_theme_child = wp_get_theme();
    $nichebase_get_parent = $nichebase_theme_child->Template;
    $nichebase_theme = wp_get_theme( $nichebase_get_parent );
} else {
    // Parent Theme Active
    $nichebase_theme = wp_get_theme();
}

define( 'NICHEBASE_NAME', $nichebase_theme->get( 'Name' ) );
define( 'NICHEBASE_VERSION', $nichebase_theme->get( 'Version' ) );
define( 'NICHEBASE_BRAND_URL', $nichebase_theme->get( 'AuthorURI' ) );
define( 'NICHEBASE_BRAND_NAME', $nichebase_theme->get( 'Author' ) );
/**
 * All Main Files Include
 */
/* Theme All Basic Setup */
require_once NICHEBASE_FRAMEWORK . '/enqueue-files.php';
require_once NICHEBASE_FRAMEWORK . '/configuration.php';
/* Bootstrap Menu Walker */
require_once NICHEBASE_FRAMEWORK . '/plugins/class-wp-bootstrap-navwalker.php';
/* Install Plugins */
require_once NICHEBASE_FRAMEWORK . '/plugins/notify/activation.php';
/* Include the TGM_Plugin_Activation class. */
require_once NICHEBASE_FRAMEWORK . '/plugins/notify/class-tgm-plugin-activation.php';
// is_premium
/* Integrate - Redux Framework */
require_once NICHEBASE_FRAMEWORK . '/theme-options.php';
/* Ccontent Width */
function nichebase_content_width()
{
    if ( !isset( $content_width ) ) {
        $content_width = 1170;
    }
}

add_action( 'after_setup_theme', 'nichebase_content_width', 0 );
if ( !function_exists( 'nichebase_is_post_type' ) ) {
    function nichebase_is_post_type( $type )
    {
        global  $wp_query ;
        if ( $type == get_post_type( $wp_query->post->ID ) ) {
            return true;
        }
        return false;
    }

}