I have registered several sidebars via functions.php like this:

// Register sidebars
function register_widgets() {
// Main sidebar
  register_sidebar( array(
    'name' => __( 'Main Sidebar', 'Core' ),
    'id' => 'main',
    'description' => __( 'The main sidebar appears on the right on each page except the front page template and blog.', 'Core' ),
    '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', 'register_widgets' );

As I’m adding more than one sidebar, I’d like to move the code to an include. This is what I have now in functions.php:

// Load widgets
require_once("includes/widgets.php");

Now that I’ve moved the sidebar code from functions.php, my theme no longer displays any widget options via Appearance > Widgets.

I can’t see that I’ve made any errors. What have I done wrong?

Read more here: register_sidebar fails when using a include within functions.php


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: