- This topic has 11 replies, 2 voices, and was last updated 6 years, 10 months ago by Leo.
-
AuthorPosts
-
June 3, 2017 at 8:44 am #328077dale
I found the earlier discussions where you showed how to display secondary navigation only on specified pages with this css:
.secondary-navigation { display: none; } .page-id-xx .secondary-navigation { display: block; }
If I also want to show the secondary nav menu on posts with a certain category, would I need to use a PHP filter then?
June 3, 2017 at 9:29 am #328103LeoStaffCustomer SupportHi Dale,
You can try this:
.secondary-navigation { display: none; } .category-xx .secondary-navigation, .single .secondary-navigation { display: block; }
June 3, 2017 at 10:56 am #328139daleThanks! That’s what I’m using to have it appear on the category archive page, but it doesn’t seem to work for the individual posts.
I purged caches and Cloudflare.
June 3, 2017 at 11:08 am #328141LeoStaffCustomer SupportTry the edited code above: https://generatepress.com/forums/topic/show-secondary-navigation-on-posts-depending-on-category/#post-328103
June 3, 2017 at 12:14 pm #328160dalePerfect Thanks!
June 3, 2017 at 12:17 pm #328162LeoStaffCustomer SupportYou’re welcome ๐
June 3, 2017 at 1:10 pm #328172daleI spoke to soon. I realized later that code made the secondary nav appear on all my single posts. I tried revising it as
.category-chechnya .secondary-navigation, .category-chechnya .single .secondary-navigation { display: block; }
But that removed it from all single posts pages for some reason …
June 3, 2017 at 1:59 pm #328179LeoStaffCustomer SupportCan you try this?
.category-chechnya .secondary-navigation, .category-chechnya.single .secondary-navigation { display: block; }
Link me to the page if it doesn’t work?
June 3, 2017 at 2:53 pm #328186daleThat didn’t work either. Could the PHP that puts the featured image/header directly below the navigation on these category pages be interfering?
Here’s an example:
https://dalecameronlowry.com/chechnya-gay-purge-26-dead-many-imprisoned/
If it’s too difficult to solve, no worries. This is a would-be-nice-to-have, not a must-have.
June 3, 2017 at 3:01 pm #328188LeoStaffCustomer SupportAhh I think you have to do something like this: https://generatepress.com/forums/topic/custom-template-for-single-post/#post-233936
June 3, 2017 at 6:35 pm #328210daleOkay. I added that PHP from the link and with this CSS,
.category-chechnya .secondary-navigation, .category-chechnya .single .secondary-navigation { display: block; }
I got the result I was looking for.
.category-chechnya .secondary-navigation, .single .secondary-navigation { display: block; }
resulted in all posts getting secondary nav, and
.category-chechnya .secondary-navigation, .category-chechnya.single .secondary-navigation { display: block; }
resulted in none getting it. just FYI.
And now with this PHP I’ll be able to go hogwild with my category formatting ๐ Thank you!
June 3, 2017 at 6:55 pm #328220LeoStaffCustomer SupportYou’re welcome!
-
AuthorPosts
- You must be logged in to reply to this topic.