0
votes

Do you have any initial ideas as to why custom sidebars would stop displaying in a Wordpress theme after update 4.4? Our login/join page showed a custom sidebar with the login/join form on the right of the page and other up until the update. This is not a custom sidebar plugin, it's part of the theme. Any thoughts? MANY thanks!

The default sidebar can be enabled, but any custom created sidebars are rendered blank.

Code registering the sidebar within functions.php:
include('includes/sidebar/sidebar.php');

Code within sidebar.php:
include('functions/custom-sidebars.php');

Full code from custom-sidebars.php:
`//// GETS OUR CUSTOM SIDEBARS $sidebars = get_option('dd_custom_sidebars');

//// IF THEY EXIST
if($sidebars) {

    //// LOOPS AND REGISTERS THEM
    foreach($sidebars as $sidebar) {

        $args = array(

            'name' => $sidebar.' — Custom',
            'id' => us_get_sidebar_id($sidebar),
            'description' => $sidebar.' — Custom Sidebar',
            'before_widget' => '<div class="sidebar-item">',
            'after_widget' => '</div>',
            'before_title' => '<h4>',
            'after_title' => '</h4>',

        );

        //// REGISTERS IT
        register_sidebar($args);

    }

}



/// FUNCTION TO GENERATE OUR FRIENDLY NAME
function us_get_sidebar_id($phrase) {

    $result = strtolower($phrase);

    $result = preg_replace("/[^a-z0-9\s-]/", "", $result);
    $result = trim(preg_replace("/[\s-]+/", " ", $result));
    $result = trim(substr($result, 0, 20));
    $result = preg_replace("/\s/", "-", $result);

    return $result;

}`
2
I'm not sure what you mean, I can see the Login form on the right on your site...dingo_d
That's a temporary form added to the default sidebar which shows on every page. Previously we had specific tailored sidebars for each page, for example the login page you visited. It's actually active but not showing.JoeW
Enable WP-DEBUG in the wp-config file. The error would be displayed then.Hareesh Sivasubramanian

2 Answers

0
votes

I had the same problem because my code that was creating custom sidebars was wrong in my sidebar.php file. I was using this …

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Block 3') ) : ?>

Instead of this

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('block-3') ) : ?>

which is the id of the sidebar from my functions.php file

0
votes

As a usable workaround (but not an answer to why the custom sidebar code is not working) I'm now dumping all the various widgets into the default sidebar which works and using the plugin Display Widgets to determine which page the widgets are shown on.