Server IP : 10.106.20.8  /  Your IP : 216.73.216.148
Web Server : Apache
System : Linux webm008.cluster106.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User : sixiemesrc ( 611999)
PHP Version : 8.0.30
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/sixiemesrc/new/wp-content/themes/gaaga/../gaaga/ocdi/../modules/sidebar/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/sixiemesrc/new/wp-content/themes/gaaga/../gaaga/ocdi/../modules/sidebar/helper.php
<?php
add_filter( 'gutenberg_use_widgets_block_editor', '__return_false' );
add_filter( 'use_widgets_block_editor', '__return_false' );

add_action( 'gaaga_after_main_css', 'sidebar_style' );
function sidebar_style() {
    wp_enqueue_style( 'gaaga-secondary', get_theme_file_uri('/modules/sidebar/assets/css/sidebar.css'), false, GAAGA_THEME_VERSION, 'all');
}

if( !function_exists( 'gaaga_check_sidebar_has_active_widgets' ) ) {
	function gaaga_check_sidebar_has_active_widgets() {

		$active_items = 0;
		$active_sidebars = gaaga_get_active_sidebars();
		if(is_array($active_sidebars) && !empty($active_sidebars)) {
			foreach( $active_sidebars as $active_sidebar ) {
				if( is_active_sidebar( $active_sidebar ) ) {
					$active_items++;
				}
			}
		}

		if($active_items > 0) {
			return true;
		}

		return false;

	}
}

if( !function_exists( 'gaaga_get_primary_classes' ) ) {
	function gaaga_get_primary_classes() {
		$default = 'page-with-sidebar with-right-sidebar';
		if(gaaga_check_sidebar_has_active_widgets()) {
			return apply_filters( 'gaaga_primary_classes', $default );
		} else {
			return 'content-full-width';
		}
	}
}

if( !function_exists( 'gaaga_get_secondary_classes' ) ) {
	function gaaga_get_secondary_classes() {
		$default = 'secondary-sidebar secondary-has-right-sidebar';
		if(gaaga_check_sidebar_has_active_widgets()) {
			return apply_filters( 'gaaga_secondary_classes', $default );
		} else {
			return '';
		}
	}
}

if( !function_exists( 'gaaga_get_active_sidebars' ) ) {
	function gaaga_get_active_sidebars() {
		return apply_filters( 'gaaga_active_sidebars', array( 'gaaga-standard-sidebar-1' ) );
	}
}

add_action( 'widgets_init', 'gaaga_sidebars' );
function gaaga_sidebars() {
	$sidebars = array(
		'name'          => esc_html__( 'Standard Sidebar', 'gaaga' ),
		'id'            => 'gaaga-standard-sidebar-1',
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h2 class="widgettitle">',
		'after_title'   => '</h2>'
	);

	if( !empty( $sidebars ) ) {
		register_sidebar( $sidebars );
	}
}

add_action( 'after_switch_theme', 'gaaga_update_default_widgets' );
function gaaga_update_default_widgets() {

	// Add widgets programmatically

	$sidebars_widgets = get_option('sidebars_widgets');
    if(isset($sidebars_widgets['gaaga-standard-sidebar-1']) && !empty($sidebars_widgets['gaaga-standard-sidebar-1'])) {
        return;
    }

	$sidebars_widgets['gaaga-standard-sidebar-1'] = array (
		'search-1',
		'recent-posts-1',
		'recent-comments-1',
		'archives-1',
		'categories-1',
	);
	update_option('sidebars_widgets', $sidebars_widgets);

	$search_widget_content[1]['title'] = esc_html__( 'Search', 'gaaga' );
	update_option( 'widget_search', $search_widget_content );

	$rp_widget_content[1]['title'] = esc_html__( 'Recent Posts', 'gaaga' );
	update_option( 'widget_recent-posts', $rp_widget_content );

	$rc_widget_content[1]['title'] = esc_html__( 'Recent Comments', 'gaaga' );
	update_option( 'widget_recent-comments', $rc_widget_content );

	$archives_widget_content[1]['title'] = esc_html__( 'Archives', 'gaaga' );
	update_option( 'widget_archives', $archives_widget_content );

	$categories_widget_content[1]['title'] = esc_html__( 'Categories', 'gaaga' );
	$categories_widget_content[1]['hierarchical'] = 1;
	update_option( 'widget_categories', $categories_widget_content );

}