Use sidebar for posts of a certain category from a custom post type

Posted in: Newspaper
Post count: 10

Hello, I would like to use a custom sidebar for posts of a certain category from a custom post type.

I don’t see a way to do this in the theme panel. When I select a custom sidebar for the categories, this sidebar is only displayed for regular posts, but not for CPT posts. I know that I can also select a custom sidebar for custom post types, but in this case, the sidebar is displayed for all CPT Posts. But I want the sidebar to be displayed only for CPT posts of a specific category. Is there a way to do this?

Post count: 27744

Hello,

You need to create a different cloud template for cpt for you want to have the sidebar or duplicate the current template and after creating the sidebar like in this guide. https://forum.tagdiv.com/sidebars-tutorial/

Thank you!

Post count: 10

Already downloaded a cloud template, but i don’t see an option to change to a cloud template in the cpt menu of the theme panel. Do i miss somthing? i can only change to cloud template in categories and post-settings menu.

Post count: 27744

Hi,

You need to assign from frontend -> https://i.imgur.com/WW7lE1K.png

Thank you!

Post count: 10

edit.

  • This reply was modified 2 years by rotatio.
  • This reply was modified 2 years by rotatio.
Post count: 10

thanks, I understand now how that works. But I can only chose cloud templates. Is there a possibility to duplicate the default template?

Post count: 10

ok I chose a blank template for my custom post type single. I can create a custom sidebar there, all fine, but the problem is, it will affect the Custom Post Type in general. That’s not what I want, as I initially said. I want the sidebar to be displayed only for CPT posts of a specific category.

Let’s say I have category A and category B. When I open a CPT post of category A, sidebar X shows up. When I open a CPT post of category B, sidebar Y shows up. That’s what I try to do.

  • This reply was modified 2 years by rotatio.
Post count: 27744

Hi,

You can duplicate a cloud template. Please check that you don’t set the template globally. Please select the template you want globally and where you want to have the sidebar assign it individually, not globally.
Also, your CPTs are here -> https://i.imgur.com/ymgp576.png so you can assign the template for each taxonomy.

Thank you!

Post count: 10

I don’t have a custom taxonomy, it’s just a normal taxonomy (category). The taxonomy field in the CPT/taxonomies-tab is empty for me.

So I guess it’s not possible using different templates for two categories (not custom taxonomy) of a Custom Post Type.

Post count: 27744

Hi,

You can have different templates, but only for normal categories. You can duplicate the template and make sure that you have assigned that template for each category.
The same steps are for all templates -> https://forum.tagdiv.com/topic/how-to-add-different-sidebare-for-different-posts-with-the-same-category/

Thank you!

Viewing 10 posts - 1 through 10 (of 10 total)
The forum ‘Newspaper’ is closed to new topics and replies.