Okay I’ve made tries with your new headermanager. Changing of logos on different pages works okay.
But I still got two further questions concerning this method.
At first: Is it possible to rename a imported header template, or to define a new one with a unique name?
And Second: I am also using a variable changing header logo in single article view (single.php), depending in which primary category the post is. Could I solve this problem with the header manager too?
Best regards
Hey ho, .
I got notified from Envato that the update to Newspaper 9.7 is already available.
I updated my localhost version and tested my custom headerstyle-10.php
As expected it wasn’t working.
I figured out that the headerstyle-10.php is now located under plugins td-composer/legacy…..
I modified the “new” headerstyle-10.php there and now it seems to be working.
The thing is that my Childtheme is now unnecessary so I removed it completly.
The only problem that I got now, is that every time td-composer is updated, I have to manually replace the headerstyle-10.php in the td-composer folder.
Is there another steady solution?
Best regards
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
Yeah exactly what I needed.
Thanks a lot i’ll give it a try.
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
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
Oh thats a pity. Is there a wasy to enable it again?
The thing is, that TD composer only works on pages, but sometimes I would need the WP Bakery Page Builder for posts.
Kind regards
Hey ho,
thanks for your reply….
I think I just have figured out a kind of solution for me.
I added some lines of code in the themes functions.php to trigger a little javascript file to change the websites logo then I am visiting the desired page or watching a post of the catgory, where the website logo should be different. Basicly the code is from codex.wordpress.org
function load_js_assets() {
if( in_category( 14 ) or is_page( 178 )) {
wp_enqueue_script('my-js', 'https://localhost/path-to-script/lchange.js', array('jquery'), '', false);
}
}
add_action('wp_enqueue_scripts', 'load_js_assets');
The thing is that the script works mostly fine but it’s way to slow. When I am visiting a desired page the script has to wait until the wrong headerlogo is loaded otherwise it wouldn’t change the logo at all.
Now my idea was is it possible to already influence the functions.php file to get the right headerlogo If I am visiting a certain page, or viewing a specific post?
I am not fit either in PHP or JS. But can you give me a hint how I can influence the theme to get the right headerlogo when I am visiting a certain page or post?
PS: I am using header-style-10
Thanks in advance
Thanks for the help.
I added the slogan in the HeaderStyle10.php file and it works just fine.
I normally don’t like adding stuff to the themes core files.
Does this change to HeaderStyle10.php means that I have to redo this process when a future update of your theme will arrive?
Kind regards
Alright I think I’ve fixed it. I excluded the admin-ajax.php from the Basic Auth. and the Mega Menu & Search option were working fine.
But is it normal that your theme is requiring files from the wp-admin folder ?
I also run two websites on other themes, and they needn’t access to the wp-admin folder.
I’ve tried to check my chrome browser while hovering the Mega Menu.
Then the error appears. Chrome says that it was unable to load that file (401):
https://www.stradeco.com/wp-admin/admin-ajax.php?td_theme_name=Newspaper&v=8.7.4
and exactly this file is in the protected Basic Auth. wp-admin folder.