Archived topic
Change logo in bulk
5 replies · Started by Danno on March 20, 2017
Hi, I love the fact that we can change the logo on some pages using the optin in the Page Header section.
I have dozens of pages I'd like to use an alternate logo for.
Any way to change those in bulk? Or is just page by page?
Thanks!
You could use PHP conditionals with the generate_logo filter: https://docs.generatepress.com/article/generate_logo/
LEt me know if you need more info :)
Thank you.
In the example, how would I correctly add the category? By name or slug or ID? (I've tried all three and couldn't see any result...)
Thanks!
add_filter( 'generate_logo','tu_category_logo' );
function tu_category_logo( $logo ) {
// Return our category logo URL
if ( is_category() ) {
return 'URL TO YOUR CATEGORY LOGO';
}
// Otherwise, return our default logo
return $logo;
}
Hi Danno,
You can use slug, name or ID which ever you wish.
Checkout this link for some examples:
https://codex.wordpress.org/Conditional_Tags#A_Category_Page
And make sure you add in the actual URL for your logo as well.
Let me know if this makes sense.
Thanks for that link.
I figured out I needed in_category, not is_category, and that made it work.
For a non-coder like me, it feels like magic!
You're welcome :) Glad you figured it out!