| Server IP : 104.26.4.103 / Your IP : 216.73.216.4 Web Server : nginx/1.27.1 System : Linux in-5 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 User : arabianexpress ( 1872) PHP Version : 8.0.30 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /storage/v9321/leapdubai/public_html/wp-content/themes/printx/inc/common/ |
Upload File : |
<?php
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function printx_widgets_init() {
$printx_footer2_switch = get_theme_mod( 'printx_footer2_switch', false );
$printx_footer3_switch = get_theme_mod( 'printx_footer3_switch', false );
$printx_footer4_switch = get_theme_mod( 'printx_footer4_switch', false );
$printx_footer5_switch = get_theme_mod( 'printx_footer5_switch', false );
/**
* blog sidebar
*/
register_sidebar( [
'name' => esc_html__( 'Blog Sidebar', 'printx' ),
'id' => 'blog-sidebar',
'before_widget' => '<div id="%1$s" class="sidebar__widget mb-30 %2$s"><div class="sidebar__widget-content">',
'after_widget' => '</div></div>',
'before_title' => '<h3 class="sidebar__widget-title">',
'after_title' => '</h3>',
] );
$footer_widgets = get_theme_mod( 'footer_widget_number', 4 );
// footer default
for ( $num = 1; $num <= $footer_widgets; $num++ ) {
register_sidebar( [
'name' => sprintf( esc_html__( 'Footer %1$s', 'printx' ), $num ),
'id' => 'footer-' . $num,
'description' => sprintf( esc_html__( 'Footer Column %1$s', 'printx' ), $num ),
'before_widget' => '<div id="%1$s" class="tp-footer__widget footer-default-widget tp-footer__widget footer-col-'.$num.' mb-30 %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="tp-footer__widget-title">',
'after_title' => '</h4>',
] );
}
// footer 2
if ( $printx_footer2_switch ) {
for ( $num = 1; $num <= $footer_widgets; $num++ ) {
register_sidebar( [
'name' => sprintf( esc_html__( 'Footer Style 2 : %1$s', 'printx' ), $num ),
'id' => 'footer-2-' . $num,
'description' => sprintf( esc_html__( 'Footer Style 2 : %1$s', 'printx' ), $num ),
'before_widget' => '<div id="%1$s" class="footer__widget footer-2-widget tp-footer__widget footer-col-'.$num.' mb-30 %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="tp-footer__widget-title">',
'after_title' => '</h4>',
] );
}
}
// footer 3
if ( $printx_footer3_switch ) {
for ( $num = 1; $num <= $footer_widgets; $num++ ) {
register_sidebar( [
'name' => sprintf( esc_html__( 'Footer Style 3 : %1$s', 'printx' ), $num ),
'id' => 'footer-3-' . $num,
'description' => sprintf( esc_html__( 'Footer Style 3 : %1$s', 'printx' ), $num ),
'before_widget' => '<div id="%1$s" class="footer__widget tp-footer-2__widget footer-col-'.$num.' %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="tp-footer-2__widget-title">',
'after_title' => '</h4>',
] );
}
}
// footer 4
if ( $printx_footer4_switch ) {
for ( $num = 1; $num <= $footer_widgets; $num++ ) {
register_sidebar( [
'name' => sprintf( esc_html__( 'Footer Style 4 : %1$s', 'printx' ), $num ),
'id' => 'footer-4-' . $num,
'description' => sprintf( esc_html__( 'Footer Style 4 : %1$s', 'printx' ), $num ),
'before_widget' => '<div id="%1$s" class="footer__widget tp-footer-4__widget footer-col-'.$num.' %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="tp-footer-4__widget-title text-black">',
'after_title' => '</h4>',
] );
}
}
// footer 5
if ( $printx_footer5_switch ) {
for ( $num = 1; $num <= $footer_widgets+1; $num++ ) {
register_sidebar( [
'name' => sprintf( esc_html__( 'Footer Style 5 : %1$s', 'printx' ), $num ),
'id' => 'footer-5-' . $num,
'description' => sprintf( esc_html__( 'Footer Style 5 : %1$s', 'printx' ), $num ),
'before_widget' => '<div id="%1$s" class="footer__widget tp-footer-5__widget footer-col-'.$num.' %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="tp-footer-5__widget-title">',
'after_title' => '</h4>',
] );
}
}
}
add_action( 'widgets_init', 'printx_widgets_init' );