WordPress.org

Ready to get started?Download WordPress

Forums

Widgets disappearing in right-hand bar (4 posts)

  1. ClaudiaCantaluppi
    Member
    Posted 11 months ago #

    Hi, I am new to WP and have a new website for my school under contruction (http://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 http://www.setificio.gov.it/2013/7/?catid=4 or pages belonging to a custom taxonomy http://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

  2. alchymyth
    The Sweeper & Moderator
    Posted 11 months ago #

    make sure that any custom queries within the main section are reset properly;
    for instance with wp_reset_query() or wp_reset_postdata()

    http://codex.wordpress.org/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; http://codex.wordpress.org/Template_Hierarchy

  3. ClaudiaCantaluppi
    Member
    Posted 11 months ago #

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

  4. ClaudiaCantaluppi
    Member
    Posted 11 months ago #

    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...

Reply

You must log in to post.

About this Topic