• Hi, I am new to WP and have a new website for my school under contruction (https://www.setificio.gov.it), using a custom theme produced by a network of Italian schools.
    We have two side bars, one on the left and one on the right.
    I have noticed that on certain pages (e.g. archives for categories https://www.setificio.gov.it/2013/7/?catid=4 or pages belonging to a custom taxonomy https://www.setificio.gov.it/trasparenza/tassi-di-assenza/) widgets disappear from the right-hand bar, although they are correctly set to appear there using widget logic. They work fine if I move them to the left-hand bar (which is not where I want them though!).
    I know it’s something in the theme but I have no idea what code I should look for and in which .php files (although my best bet is the one called rightsidebar.php)
    My WP is updated to 3.6, but the same issue was there with 3.5.2.
    Any help would be very appreciated!
    Claudia

Viewing 3 replies - 1 through 3 (of 3 total)
  • make sure that any custom queries within the main section are reset properly;
    for instance with wp_reset_query() or wp_reset_postdata()

    https://codex.www.ads-software.com/Class_Reference/WP_Query#Usage

    i.e. if this happens with some category archives, check category.php and/or any custom category or taxonomy templates; https://codex.www.ads-software.com/Template_Hierarchy

    Thread Starter ClaudiaCantaluppi

    (@claudiacantaluppi)

    Thanks. I forgot to say I have practically no php, but I will try and check!

    Thread Starter ClaudiaCantaluppi

    (@claudiacantaluppi)

    Ok, I solved it by very very closely looking at the theme file rightsidebar.php .

    In the original we had

    <?php
    	if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : endif;
    }
    if (is_page () and !is_front_page ()){
    	$post->ID=$IdPagina;
    	$post->post_title=$TitoloPagina;
    	if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : endif;
    }
    if (is_category ()||is_archive () || is_page() ) {

    Trying a few times I ended up with

    <?php 
    
    }
    if (is_page () and !is_front_page ()){
    	$post->ID=$IdPagina;
    	$post->post_title=$TitoloPagina;
    
    }
    if (is_category ()||is_archive () || is_page()|| is_singular() ) {
    	if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : endif;

    It works, though I’m not sure about braces…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Widgets disappearing in right-hand bar’ is closed to new replies.