Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #884005
    malingroup
    Participant

    Support,

    I have followed and implemented the codes as listed in this thread: https://community.theme.co/forums/topic/create-sidebar-for-post-category/

    However i do not get an option under categories to select a sidebar.

    Appreciate your assistance.

    #884006
    malingroup
    Participant
    This reply has been marked as private.
    #884824
    Jade
    Moderator

    Hi there,

    Thanks for writing in. As the thread you have referred to is quite long, would you mind pointing out which part of the thread you are pointing to specifically as I am not certain based on what you mentioned. Thank you.

    #887918
    malingroup
    Participant

    Hi,

    The first support reply on that thread included coding to modify the functions.php and wp-single.php to give the ability to select a sidebar when defining a category, thus giving category specific sidebars for individual posts. I have implemented this coding and i do not get this ability when creating a category.

    #888152
    Paul R
    Moderator

    Hi,

    The code is quite old and will not work in the latest version of x.

    You can try this code instead. Add this in your child theme’s functions.php file

    
    add_filter( 'ups_sidebar', 'my_blog_sidebar', 9999 );
    
    function my_blog_sidebar ( $default_sidebar ) {
     if(is_category( '35' )){
         return 'ups-sidebar-ballast-blog';
     } 
      return $default_sidebar;
    }
    

    35 is category id of Ballast Blog category and ups-sidebar-ballast-blog is your sidebar id

    http://screencast.com/t/yPPVXL3TBXI

    If you need to add another category, you can add another elseif statement

    eg.

    
    add_filter( 'ups_sidebar', 'my_blog_sidebar', 9999 );
    
    function my_blog_sidebar ( $default_sidebar ) {
     if(is_category( '35' )) {
         return 'ups-sidebar-ballast-blog';
     } elseif (is_category( '36' )) {
         return 'ups-sidebar-blog';
      }
      return $default_sidebar;
    }
    

    https://community.theme.co/kb/how-to-locate-category-ids/

    Hope that helps.

    #893544
    malingroup
    Participant

    Hi thank you for the detailed reply. I tried this code in my child theme’s functions.php but it still does not show the correct sidebar for individual posts relevant to that specific category?

    #894399
    Jade
    Moderator

    Hi there,

    Please provide us with your FTP details so that we could test it.

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

    #894402
    Jade
    Moderator

    Hi there,

    Please provide us with your FTP details so that we could test it.

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

    #894922
    malingroup
    Participant
    This reply has been marked as private.
    #896024
    Rad
    Moderator

    Hi there,

    The code above is only to display the specific sidebar to a specific category page. What you’re trying to achieve is display specific sidebar to post that belongs to a specific category.

    The thread you provided has the correct implementation, but it’s too old and long discussion. Please follow the discussion and implement the codes that are mentioned. Then Let me know and I’ll check what else needed to update to match the recent X’s templates.

    Thanks!

    #898225
    malingroup
    Participant

    Hi,

    I have now implemented the codes from the previous thread. Appreciate if you can check what else is needed to get this code working with the recent X templates.

    Many thanks!

    #899709
    Paul R
    Moderator

    Hi,

    I was able to fix it, kindly check on your end.

    Thanks

    #900362
    malingroup
    Participant

    thank you very much. Your support is second to none..!

    #901578
    Lely
    Moderator

    You’re welcome!

    Cheers!

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