WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Eleven
[resolved] rename 'Main Sidebar' in widget editing dashboard (3 posts)

  1. offpeakdesign
    Member
    Posted 8 months ago #

    Hi, wondering if anyone can help me figure out how to change the displayed name of "Main Sidebar" within the widget editing dashboard. I have a child theme and child functions file, but simply copying and pasting the registered sidebar, then modifying the name in my child functions file doesn't have any affect.

    In original functions file:

    register_sidebar( array(
    		'name' => __( 'Main Sidebar', 'twentyeleven' ),
    		'id' => 'sidebar-1',
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => "</aside>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );

    In child functions file:

    register_sidebar( array(
    		'name' => __( 'NEWNAME Sidebar', 'twentyeleven' ),
    		'id' => 'sidebar-1',
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => "</aside>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
  2. offpeakdesign
    Member
    Posted 8 months ago #

    I actually found this and applied it, which seems to affect the widgets, but still doesn't override the name for some reason...

    remove_action( 'widgets_init', 'twentyeleven_widgets_init' );
    
    function ofpk_widgets_init() {
    
       	register_sidebar( array(
    		'name' => __( 'NEWNAME Sidebar', 'twentyeleven' ),
    		'id' => 'sidebar-1',
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => "</aside>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
    
    }
    add_action( 'widgets_init', 'ofpk_widgets_init' );
  3. offpeakdesign
    Member
    Posted 8 months ago #

    Found out what I needed to add:

    // My Child Theme Setup
    add_action( 'after_setup_theme', 'twentyeleven_child_theme_setup', 11 );
    
    function twentyeleven_child_theme_setup() {
    
    new widget code
    
    }

    Realized that the child function file was recognized first, and needed to be recognized after the original function file. Reference link

Reply

You must log in to post.

About this Theme

About this Topic