• Resolved mcography

    (@mcography)


    I have two footer widgets in my parent theme that I need to unregister, so that I can register 3 new footer widgets in my child theme. (The child theme footer needs to be 3 columns.) This is what is in the parent theme:

    // Create Footer Left widget area.
    	$sidebars = array('footer-left');
    	foreach ($sidebars as $sidebar) {
        register_sidebar(array('name'=> $sidebar,
        	'id' => 'footer-left',
        	'name' => __('Footer Left', 'slamtheme'),
    		'description' => 'This widget controls the left footer column.',
            'before_widget' => '<div class="large-6 large-uncentered medium-6 medium-uncentered small-12 small-centered columns footer-left"><article id="%1$s" class="widget %2$s">',
            'after_widget' => '</article></div>',
            'before_title' => '<h4>',
            'after_title' => '</h4>'
        ));
    	}
    
    	// Create Footer Right widget area.
    	$sidebars = array('footer-right');
    	foreach ($sidebars as $sidebar) {
        register_sidebar(array('name'=> $sidebar,
        	'id' => 'footer-right',
        	'name' => __('Footer Right', 'slamtheme'),
    		'description' => 'This widget controls the right footer column.',
            'before_widget' => '<div class="large-6 large-uncentered medium-6 medium-uncentered small-12 small-centered columns footer-right"><article id="%1$s" class="widget %2$s">',
            'after_widget' => '</article></div>',
            'before_title' => '<h4>',
            'after_title' => '</h4>'
        ));
    	}

    I put this in my child theme…

    //Unregister Footer Widget
    add_action( 'widgets_init', 'unregister_widgets', 11 );
    
    function unregister_widgets() {
    
        // remove (some) WordPress default Widgets
        unregister_widget( 'footer-left' );
        unregister_widget( 'footer-right' );
    
    }

    …but it did nothing. What am I doing wrong? How can I unregister these footer widgets?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to Unregister Footer Widget from Parent Theme’ is closed to new replies.