Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1191290
    jonesy2367
    Participant

    Hi

    My sidebars in specific categories are no longer working. I set up a test category and test sidebar but can’t seem to make it work

    could you advise?

    many thanks

    #1191323
    Rahul
    Moderator

    Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    #1191339
    jonesy2367
    Participant
    This reply has been marked as private.
    #1191344
    jonesy2367
    Participant

    here’s a screenshot of the sidebar settings..

    #1191379
    jonesy2367
    Participant

    Hi – i could get the ‘test sidebar’ to appear on a page but it just doesn’t seem to work on a post?

    #1191789
    Paul R
    Moderator

    Hi,

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    #1191955
    jonesy2367
    Participant
    This reply has been marked as private.
    #1192007
    Paul R
    Moderator

    Hi,

    You can try adding this in your child theme’s functions.php file.

    
    add_filter( 'ups_sidebar', 'fix_category_sidebar' );
    
    function fix_category_sidebar($default_sidebar ) {
         $categories = get_the_category();
         $post_categories = array();
         if(is_array($categories)) {
         foreach ( $categories as $category ) {
              $post_categories[] = $category->term_id;
         }
         }
         
         $sidebars   = get_option( 'ups_sidebars' );
         if(is_array($sidebars)){
         foreach ( $sidebars as $id => $sidebar ) {    
                if(isset($sidebar['taxonomies']) && is_array($sidebar['taxonomies'])){         
                 foreach($sidebar['taxonomies'] as $t_id => $tax) {
                     if(in_array($t_id,$post_categories)) {
                         return $id;
                     }
                 }               
                 }           
         }
         }
        return $default_sidebar ;
    }
    

    Hope that helps.

    #1193639
    jonesy2367
    Participant

    wonderful that’s worked a treat

    thanks very much 🙂

    #1193676
    Thai
    Moderator

    You’re most welcome 🙂

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