<?php
/**
* Layout Functions
*
* @package GridMini WordPress Theme
* @copyright Copyright (C) 2025 ThemesDNA
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
* @author ThemesDNA <themesdna@gmail.com>
*/

function gridmini_hide_footer_widgets() {
    $hide_footer_widgets = false;

    if ( gridmini_get_option('hide_footer_widgets') ) {
        $hide_footer_widgets = true;
    }

    return apply_filters( 'gridmini_hide_footer_widgets', $hide_footer_widgets );
}

function gridmini_is_header_content_active() {
    $header_content_active = true;

    if ( gridmini_get_option('hide_header_content') ) {
        $header_content_active = false;
    }

    return apply_filters( 'gridmini_is_header_content_active', $header_content_active );
}

function gridmini_is_primary_menu_active() {
    $primary_menu_active = true;

    if ( gridmini_get_option('disable_primary_menu') ) {
        $primary_menu_active = false;
    }

    return apply_filters( 'gridmini_is_primary_menu_active', $primary_menu_active );
}

function gridmini_is_menu_social_bar_active() {
    $menu_social_bar_active = true;

    if ( gridmini_get_option('disable_menu_social_bar') ) {
        $menu_social_bar_active = false;
    }

    return apply_filters( 'gridmini_is_menu_social_bar_active', $menu_social_bar_active );
}

function gridmini_is_secondary_menu_active() {
    $secondary_menu_active = true;

    if ( gridmini_get_option('disable_secondary_menu') ) {
        $secondary_menu_active = false;
    }

    return apply_filters( 'gridmini_is_secondary_menu_active', $secondary_menu_active );
}

function gridmini_is_social_buttons_active() {
    $social_buttons_active = true;

    if ( gridmini_get_option('hide_header_social_buttons') ) {
        $social_buttons_active = false;
    }

    return apply_filters( 'gridmini_is_social_buttons_active', $social_buttons_active );
}

function gridmini_is_fitvids_active() {
    $fitvids_active = true;

    if ( gridmini_get_option('disable_fitvids') ) {
        $fitvids_active = false;
    }

    return apply_filters( 'gridmini_is_fitvids_active', $fitvids_active );
}

function gridmini_is_backtotop_active() {
    $backtotop_active = true;

    if ( gridmini_get_option('disable_backtotop') ) {
        $backtotop_active = false;
    }

    return apply_filters( 'gridmini_is_backtotop_active', $backtotop_active );
}



/**
 * 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 gridmini_content_width() {
    $content_width = 872;

    if ( is_singular() ) {
        if ( is_page_template( array( 'template-full-width-page.php', 'template-full-width-post.php' ) ) ) {
           $content_width = 1222;
        } else {
            $content_width = 872;
        }
    } else {
        $content_width = 1222;
    }

    $GLOBALS['content_width'] = apply_filters( 'gridmini_content_width', $content_width ); /* phpcs:ignore WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound */
}
add_action( 'template_redirect', 'gridmini_content_width', 0 );