HEX
Server: Apache/2.4.65 (Debian)
System: Linux web6 5.10.0-36-amd64 #1 SMP Debian 5.10.244-1 (2025-09-29) x86_64
User: innocamp (1028)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/dragonhs/public_html/wp-content/themes/instock-lite/functions.php
<?php

/**
 * Theme functions file
 *
 * Contains all of the Theme's setup functions, custom functions,
 * custom hooks and Theme settings.
 */

/**
 * Instock only works in WordPress 4.7 or later.
 */
if (version_compare($GLOBALS['wp_version'], '4.7', '<')) {
    require get_template_directory() . '/inc/back-compat.php';
    return;
}

if (!function_exists('instock_lite_setup')) :
    /**
     * Sets up theme defaults and registers support for various WordPress features.
     */
    function instock_lite_setup() {

        // Make the theme available for translation.
        load_theme_textdomain('instock-lite', trailingslashit(get_template_directory()) . 'languages');

        // Add RSS feed links to <head> for posts and comments.
        add_theme_support('automatic-feed-links');

        /*
         * Let WordPress manage the document title.
         * By adding theme support, we declare that this theme does not use a
         * hard-coded <title> tag in the document head, and expect WordPress to
         * provide it for us.
         */
        add_theme_support('title-tag');

        // Enable support for Post Thumbnails.
        add_theme_support('post-thumbnails');
        set_post_thumbnail_size(1170, 9999);

        // Register custom navigation menu.
        register_nav_menus(
            array(
                'menu-1' => esc_html__('Main Location', 'instock-lite'),
                'social' => esc_html__('Social Links', 'instock-lite')
            )
        );

        /*
         * Switch default core markup for search form, comment form, and comments
         * to output valid HTML5.
         */
        add_theme_support('html5', array(
            'comment-form',
            'comment-list',
            'gallery',
            'caption',
        ));

        // Setup the WordPress core custom background feature.
        add_theme_support('custom-background', apply_filters('instock_lite_custom_background_args', array(
            'default-color' => 'ffffff'
        )));

        // Enable support for Custom Logo
        add_theme_support('custom-logo', array(
            'height'     => 41,
            'width'      => 96,
            'flex-width'  => true,
            'flex-height' => true,
        ));

        // This theme uses its own gallery styles.
        add_filter('use_default_gallery_style', '__return_false');

        // Indicate widget sidebars can use selective refresh in the Customizer.
        add_theme_support('customize-selective-refresh-widgets');

        // Add support for Block Styles.
        add_theme_support('wp-block-styles');

        // Add support for full and wide align images.
        // add_theme_support( 'align-wide' );

        // Add support for editor styles.
        add_theme_support('editor-styles');

        // Enqueue editor styles.
        add_editor_style('style-editor.css');

        // Add support for responsive embeds.
        add_theme_support('responsive-embeds');

        // Disable Kirkir telemetry
        add_filter('kirki_telemetry', '__return_false');
    }
endif; // instock_lite_setup
add_action('after_setup_theme', 'instock_lite_setup');

/**
 * Set the content width in pixels, based on the theme's design and stylesheet.
 *
 * Priority 0 to make it available to lower priority callbacks.
 *
 * @global int $content_width
 */
function instock_lite_content_width() {
    // This variable is intended to be overruled from themes.
    // Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
    // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
    $GLOBALS['content_width'] = apply_filters('instock_lite_content_width', 825);
}
add_action('after_setup_theme', 'instock_lite_content_width', 0);

/**
 * Registers widget areas and custom widgets.
 *
 * @link  http://codex.wordpress.org/Function_Reference/register_sidebar
 */
function instock_lite_sidebars_init() {

    register_sidebar(
        array(
            'name'          => esc_html__('Primary', 'instock-lite'),
            'id'            => 'primary',
            'description'   => esc_html__('Main sidebar that appears on the right.', 'instock-lite'),
            'before_widget' => '<aside id="%1$s" class="widget %2$s">',
            'after_widget'  => '</aside>',
            'before_title'  => '<h3 class="widget-title module-title">',
            'after_title'   => '</h3>',
        )
    );

    if (instock_lite_is_woocommerce_activated()) {
        register_sidebar(
            array(
                'name'          => __('WooCommerce Sidebar', 'instock-lite'),
                'id'            => 'woo_sidebar',
                'description'   => __('Widgets in this area are used in your WooCommerce sidebar for shop pages and product posts.', 'instock-lite'),
                'before_widget' => '<aside id="%1$s" class="widget %2$s">',
                'after_widget'  => '</aside>',
                'before_title'  => '<h3 class="widget-title">',
                'after_title'   => '</h3>',
            )
        );
    }

    // Get the footer widget column from Customizer.
    $widget_columns = get_theme_mod('footer_widgets_columns', '4');
    for ($i = 1; $i <= $widget_columns; $i++) {
        register_sidebar(
            array(
                'name'          => sprintf(esc_html__('Footer %s', 'instock-lite'), $i),
                'id'            => 'footer-' . $i,
                'description'   => esc_html__('Sidebar that appears on the bottom of your site.', 'instock-lite'),
                'before_widget' => '<aside id="%1$s" class="widget %2$s">',
                'after_widget'  => '</aside>',
                'before_title'  => '<h3 class="widget-title module-title">',
                'after_title'   => '</h3>',
            )
        );
    }
}
add_action('widgets_init', 'instock_lite_sidebars_init');

/**
 * Enqueue scripts and styles.
 */
function instock_lite_scripts() {

    $theme_version = wp_get_theme()->get('Version');

    wp_enqueue_style('instock-lite-fonts', instock_lite_fonts_url(), array(), $theme_version);

    wp_enqueue_style('instock-lite-style', get_stylesheet_uri(), array(), $theme_version);
    wp_style_add_data('instock-lite-style', 'rtl', 'replace');

    // If child theme is active, load the stylesheet.
    if (is_child_theme()) {
        wp_enqueue_style('instock-lite-child-style', get_stylesheet_uri());
    }

    wp_enqueue_script('instock-lite-skip-link-focus-fix', get_theme_file_uri('/assets/js/skip-link-focus-fix.js'), array(), '1.0.0', true);

    wp_enqueue_script('instock-lite-keyboard-navigation', get_theme_file_uri('/assets/js/navigation.js'), array(), '1.0.0', true);

    wp_enqueue_script('instock-lite-fitvids', get_theme_file_uri('/assets/js/jquery.fitvids.js'), array('jquery'), '1.0.0', true);

    wp_enqueue_script('instock-lite-custom-js', get_theme_file_uri('/assets/js/custom.js'), array('jquery'), '1.0.0', true);

    /**
     * js / no-js script.
     *
     * @copyright http://www.paulirish.com/2009/avoiding-the-fouc-v3/
     */
    wp_add_inline_script('instock-lite-custom-js', "document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/,'js');");

    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }

    wp_localize_script('instock-lite-keyboard-navigation', 'accessibleNavigationScreenReaderText', array(
        'expandMain'   => esc_html__('Open the main menu', 'instock-lite'),
        'collapseMain' => esc_html__('Close the main menu', 'instock-lite'),
        'expandChild'  => esc_html__('expand submenu', 'instock-lite'),
        'collapseChild' => esc_html__('collapse submenu', 'instock-lite'),
    ));
}
add_action('wp_enqueue_scripts', 'instock_lite_scripts');

/**
 * Register custom fonts.
 */
function instock_lite_fonts_url() {
    $fonts_url = '';

    /*
     * Translators: If there are characters in your language that are not
     * supported by Nunito, translate this to 'off'. Do not translate
     * into your own language.
     */
    $nunito = _x('on', 'Nunito font: on or off', 'instock-lite');

    if ('off' !== $nunito) {
        $font_families = array();

        $font_families[] = 'Nunito:400,400i,600,700,800';

        $query_args = array(
            'family' => urlencode(implode('|', $font_families)),
            'subset' => urlencode('latin,latin-ext'),
        );

        $fonts_url = add_query_arg($query_args, 'https://fonts.googleapis.com/css');
    }

    return esc_url_raw($fonts_url);
}

if (!function_exists('instock_lite_is_elementor_activated')) :
    /**
     * Check if Elementor is active
     */
    function instock_lite_is_elementor_activated() {
        return defined('ELEMENTOR_VERSION');
    }
endif;

if (!function_exists('instock_lite_is_woocommerce_activated')) :
    /**
     * Check if WooCommerce is active
     */
    function instock_lite_is_woocommerce_activated() {
        return class_exists('WooCommerce') ? true : false;
    }
endif;

if (!function_exists('instock_lite_is_yww_activated')) {
    /**
     * Check if YITH WooCommerce Wishlist is activated.
     */
    function instock_lite_is_yww_activated() {
        return class_exists('YITH_WCWL') ? true : false;
    }
}

if (!function_exists('instock_lite_is_quick_view_activated')) {
    /**
     * Check if Woo Smart Quick View is activated.
     */
    function instock_lite_is_quick_view_activated() {
        return class_exists('WPcleverWoosq') ? true : false;
    }
}

if (!function_exists('instock_lite_is_smart_compare_activated')) {
    /**
     * Check if Woo Smart Smart Compare is activated.
     */
    function instock_lite_is_smart_compare_activated() {
        return class_exists('WPcleverWooscp') ? true : false;
    }
}

/**
 * Custom template tags for this theme.
 */
require trailingslashit(get_template_directory()) . 'inc/template-tags.php';

/**
 * Helpers functions.
 */
require trailingslashit(get_template_directory()) . 'inc/template-functions.php';

/**
 * Require and recommended plugins list.
 */
require trailingslashit(get_template_directory()) . 'inc/plugins.php';

/**
 * WooCommerce integration
 */
if (instock_lite_is_woocommerce_activated()) {
    require trailingslashit(get_template_directory()) . 'inc/woocommerce.php';
}

/**
 * Load Elementor compatibility file.
 */
if (instock_lite_is_elementor_activated()) {
    require trailingslashit(get_template_directory()) . 'inc/elementor/elementor.php';
}