Hey ho again…
Thanks for all of your help.
The solution with the childtheme and the modified header-style.php is working flawlessly. I got the changing header logo for the is_page and the is in_category function (With 4 different logos).
But there is still a little problem with that. The thing is that there are some posts, who are in multiple categories. For example category1 (with headerlogo 1) and category2 (with headerlogo 2).
If I visit for example a page or a category page where the posts are, the logo is doing just fine, but if I click on a post and want to view the single post, the head always shows the headerlogo1 of category1 (I guess it has something to do with the alphabetical order of my categories).
Headerlogo1 in this case isn’t wrong, because the post is in this category as well.
But when I am visiting category2 and click on a post I want to have the head showing headerlogo2 and not headerlogo1.
I hope you’ll get my point.
How can I influence the headerstyle, that wordpress knows from which page I am coming from and displays the correct logo?
Is this possible at all?
Thanks in advance
I think I’ve managed out a little solution for this problem.
I was able to modify the header-style.php to let the single article header logo change depending on in wich primary category the post is.
The thing is that I am using the Yoast SEO plugin and found a little code snippet to let me get the current YOAST primary category variable in .php. With that variable I was able to trigger the logo change in the header-style.php.
I know there is also a primary category dropdown from the Newspaper theme to control the breadcrumb menu etc..
Is it possible that you can tell me the appropriate .php file to edit and the variable who is responsible for the primary category setting ?
Thanks in advance
Where is the original post on this? This is something I’m looking to do.
It’s not what it was originally designed to do, but Advanced Ads might be able to do that with a rotating ad group. You can make the change random or you can weight different “ads”. The groups can be placed with a shortcode.
Anyway, maybe it will work for you.
Kim
If you are referring to his drop-down primary category
https://www.screencast.com/t/KsjO3ebWppK
then you’ll need to go in wp-content\themes\Newspaper\includes\wp_booster\wp-admin\content-metaboxes\td_set_post_settings.php
https://www.screencast.com/t/A87Zg8P7Zrn
Thank you.
Yeah exactly what I needed.
Thanks a lot i’ll give it a try.
Hi again one little question.
Do you already have a php function for me which returns the appropriate ID of the td_primary_cat for me?
I am bit lost in querying the DB with wpdb.
Thanks in advance
Hi,
Unfortunately I do not have one, but maybe this articles will help you.
-> https://developer.wordpress.org/reference/functions/get_the_category/
-> https://wordpress.stackexchange.com/questions/228821/how-to-get-primary-category-name-in-wordpress-new-version
-> https://stackoverflow.com/questions/38800626/how-to-get-primary-category-set-via-yoast-seo-plugin-in-wordpress
Hope this will help you.