dynamic_sidebar() stopped working

In a case like this, you’re probably going to need to check the conditions in dynamic_sidebar to find out what is not happening. if (isset($_GET[‘debugsidebar’])) {add_action(‘init’, ‘debug_sidebar’);} function debug_sidebar() { $id = $_GET[‘debugsidebar’]; $sidebarswidgets = get_option(‘sidebars_widgets’); if (is_active_sidebar($id)) {$status = ” Active”;} else {$status = “Inactive”;} echo “Sidebar ID: “.$id.” (“.$status.”)<br>”; if (array_key_exists($id, $sidebarswidgets)) { … Read more

Add class to on sidebar widget

In functions.php file : add_action( ‘widgets_init’, ‘my_register_sidebars’ ); function my_register_sidebars() { /* Register the ‘primary’ sidebar. */ register_sidebar( array( ‘id’ => ‘sidebar-2’, ‘name’ => __( ‘Main Sidebar’, ‘mystic’ ), ‘description’ => __( ‘A short description of the sidebar.’, ‘mystic’ ), ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’, ‘after_widget’ => ‘</div>’, ‘before_title’ => ‘<h3 class=”widget-title”>’, ‘after_title’ => … Read more

Sidebar endpoint using WordPress API

Is there a default endpoint for sidebars? No, I don’t think there is. So (for now), using a custom REST API endpoint does sound like a good option to me. gives me the sidebar not in json format and then a json response with an empty body_response That’s because get_sidebar() echo the output, hence the … Read more

get_sidebar() will not work in footer.php

You need to read the documentation, get_sidebar(): Includes the sidebar template for a theme or if a name is specified then a specialised sidebar will be included. Its purpose is to load sidebar.php. It does not output widgets. To output widgets you need to use dynamic_sidebar(): <?php dynamic_sidebar( ‘sidebar-1’ ); ?> That will output the … Read more

Extra copy of sidebar appears in footer

IF you look at all the templates included in your question, the reason becomes obvious: You’re outputting the sidebar twice. In index.php you use get_sidebar(), which loads sidebar.php. In that template you’re outputting the widgets: <aside id=”secondary” class=”widget-area”> <?php dynamic_sidebar( ‘sidebar-1′ ); ?> </aside><!– #secondary –> You’re also using get_footer(), which loads footer.php. In that … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)