Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1243832
    inlifestyle
    Participant

    Can anything be done if the last category doesnt have a sidebar assigned to it, can it fall back to the 2nd or 3rd to last category added?

    #1244626
    Rad
    Moderator

    Hi there,

    It pickups the categories assigned to the post hence, if there is no assigned category then it’s empty and no second, third, or fourth. Though I see a flaw from that code, let’s change it to this so it would use Main Sidebar as default when there is no assigned sidebar to the category.

    add_filter( 'ups_sidebar', 'ups_display_category_sidebar', 99 );
    
    function ups_display_category_sidebar ( $sidebar ) {
    
      
    
    if ( is_singular( 'post' ) ) {
    
        $terms = get_the_terms( get_the_ID(), 'category' );
        
    
        if ( isset( $terms ) && count( $terms ) > 0 ) {
    
              $term = array_pop( $terms );
              $setting = get_option( "taxonomy_".$term->term_id );
              $sidebar = !empty( $setting['category-sidebar'] ) ?  $setting['category-sidebar'] : $sidebar;
    
        }
    
    }
    
    return $sidebar;
    
    }

    Cheers!

    #1258056
    inlifestyle
    Participant

    Can it use the sidebar from the 2nd or 3rd if the first category didnt have a sidebar associated with it?

    #1259795
    Rad
    Moderator

    Hi there,

    It can’t, but it will use the default Main Sidebar if there is no assigned sidebar. What you need to achieve is possible through another set of code, but that will make it much slower since it needs to run on every page’s load just to detect the availability for the category sidebar. And you may wish to consult it to a developer since it’s more complex.

    Thanks for understanding.

    #1286236
    inlifestyle
    Participant

    We are experiencing disappearing sidebars, what could be causing this? Is there a max, we do have a lot but wouldnt think it would start deleting custom sidebars.

    #1286619
    Lely
    Moderator

    Hello There,

    Would you mind giving us the specific link where the sidebar disappear? This is to ensure that we can provide you with a tailored answer to your situation.

    #1290497
    inlifestyle
    Participant
    This reply has been marked as private.
    #1292123
    Lely
    Moderator

    Hello There,

    I did check your error log via FTP. There was no error log recently and the last one was dated January 5 2016. Then I did check again your custom Sidebars and it is there although it took a while for everything to load. See this:http://screencast-o-matic.com/watch/cDl2VjQ32q

    #1293466
    inlifestyle
    Participant

    yes the custom sidebars are there, but 16 of them disappeared and we had to recreate them. What would be the explanation for this?

    #1293781
    Rad
    Moderator

    Hi there,

    Have you updated your X theme from the very old version? Or did some search and replace within the database? That’s the only two reason I could think of since custom sidebars are saved within the database.

    Thanks!

    #1307509
    inlifestyle
    Participant

    We didnt do anything in the database or upload at the time the sidebars disappeared.

    #1307986
    Rad
    Moderator

    Hi there,

    Hmm, I’m not sure what happened and this is my first time hearing this kind of issue. And it shouldn’t disappear just like that, it’s either accidentally removed or corrupted data.

    You may restore your backup if available.

    Thanks!

  • <script> jQuery(function($){ $("#no-reply-1163391 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>