WordPress.org

Support

Support » How-To and Troubleshooting » Adding id’s to sidebar widgets in functions.php made widgets disappear

Adding id’s to sidebar widgets in functions.php made widgets disappear

  • llamaman

    @llamaman

    Hello!

    Here’s my problem:
    I have 13 widgetized areas on my website, each with different content. This morning, I wanted to re-organize the order in which they display, so I gave them each their own id in the “register_sidebar” function array in my functions.php file. For example, I changed this:

    register_sidebar(array(
    				"name" => "Home Page Sidebar Top",
    				"before_widget" => '<div class="widget %2$s">',
    				"after_widget" => '</div>',
    				"before_title" => '<strong class="widgetTitle">',
    				"after_title" => '</strong>'
    				));

    to this:

    register_sidebar(array(
    				"name" => "Home Page Sidebar Top",
    				"id" => "1",
    				"before_widget" => '<div class="widget %2$s">',
    				"after_widget" => '</div>',
    				"before_title" => '<strong class="widgetTitle">',
    				"after_title" => '</strong>'
    				));

    The problem is when I did this, it reset all of my widgets (i.e. it made all of my widgets disappear). I reverted back to my old functions.php file, and the widgets are still not displaying.

    Does anyone know how I might get my old widgets back?

    Thank you!

  • The topic ‘Adding id’s to sidebar widgets in functions.php made widgets disappear’ is closed to new replies.
Skip to toolbar