The easiest way to hide/display the secondary title on specific pages is very easily done via CSS.
Go to the affected page.
In your admin bar on top of the screen, click “Customize”
Below, open “Custom CSS”
Here, we can now make up our rules. However, this only works if we give the secondary an HTML class or ID – otherwise we can’t find it in CSS. So, let’s do that.
Go to Secondary Title’s settings page
Make sure “Auto show” is “On”
In “Title format”: Make up your format and wrap the secondary title in a span just like in this example:
We now have the class .secondary-title and can now control where it shows up where it doesn’t.
Since we want it to show up on most pages, we only have to navigate to one of the affected pages and find the <body>. This element has a class with many identifying information, like “home”, or “single”, or “password-protected”.
If we don’t want to display the secondary title on single post pages, follow the instructions above and use this in your Custom CSS:
.singular .secondary-title {
display: block;
}
P.S.: Use Google Chrome’s inspector tool to see if an element has the right class, like here:
Again, in short:
Do not touch the theme (yet)
turn “Auto show” on and wrap the secondary title into a <span>-Tag.
Give the tag a class, i.e. <span class="secondary-title">
Find out a unique class from the pages’ <body> classes
Use display: none; in CSS to hide it. You might have to use !important.
Thanks for your reply. I think I need to explain more what my issue is. I am not trying to control on which pages secondary title appears.
My issue is that in my Astra theme, secondary title is appearing in BOTH the header (which is what I want) and also in the COMMENTS section title. It is inserting raw html right next to the comments title. See what I mean:
So your solution to block secondary title using css would not help because then it would also block secondary title from the header too.
Do you know how I can stop it from inserting this raw html into the comments section title?
This is one of the affected pages: https://rb.gy/6b3hqt It does this to EVERY comments section title of EVERY post when there is a comment for that page.
I kind of have to tip-toe here. On one side, I’d really like to help you out quickly, but forum guidelines forbid me.
A huge help would be if I had access to your website – no, dear forum mods, not that access – like the theme directories in use. Please send the files .zipped to kolja.nolte @ gmail.com, and I’ll have a look at how you can solve this through my instructions.
This reply was modified 1 year, 7 months ago by thaikolja.
My hands are tied behind my back. There’s only so much support a developer can give without seeing the actual code. Which you still haven’t sent to me.