Integrity stack - change posts sidebar

Hi there!

I created a new sidebar for the blog index page, and I’m trying to get it to display on the posts pages but it’s not working. I’m hoping there is a way to make it work automatically with the posts that are there and the posts created going forward. How can I make this happen?

Thank you!
Julianne

Hello Julianne,

Thanks for asking. :slight_smile:

To have sidebar on post page, under Content Layout make the selection as per your requirement other then Fullwidth.

To learn more about X Theme and Cornerstone, please take a look at our Knowledgebase section:

Thanks.

Hi Prashant,

Thanks for responding. I wasn’t quite clear enough, I know how to get the side bar to appear. What I’m trying to do is change the side bar on the posts page from the main sidebar to the blog sidebar that I’ve just created. The only way I have been able to do it is to go into the sidebar configuration and manually check off each post I want it to appear on, which is pretty inconvenient. I want this to be the automatic default sidebar for the posts pages, can you tell me how to change the sidebar?

Thanks!

I meant, hi Prasant!

Hey Julianne,

That is possible by filtering the ups-sidebar like this.

function single_post_sidebar( $sidebar ){ 
       if ( is_singular( 'post' ) )  {      
           return 'ups-sidebar-blog';        
       }    
  return $sidebar;
}

add_filter( 'ups_sidebar', 'single_post_sidebar');

The code should be added in functions.php.

Hope that helps.

Worked perfectly! Thanks so much for your help!

You are most welcome. In above code my colleague used WordPress conditional tag is_singular. If you would like to learn more about conditional tags then please take a look at following resources:

https://codex.wordpress.org/Function_Reference/is_singular
https://codex.wordpress.org/Conditional_Tags

Thanks.

Great, thanks for the info!

You are most welcome. :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.