-
AuthorPosts
-
August 27, 2014 at 6:34 am #309666
Hi,
ive used the following code (http://kriesi.at/documentation/enfold/change-the-logo-url-on-some-pages/) which worked perfectly, however how would I alter this to show the alternative logo (the one that I have specified in the code) on portfolio pages that are part of a certain category and pages with a certain ID. Thanks in advance for your help.August 27, 2014 at 3:51 pm #309893Hey fonterra!
Please add following code to Functions.php file in Appearance > Editor
add_filter('avf_logo','av_change_logo'); function av_change_logo($logo) { if( is_page( 59 ) ) { $logo = "http://kriesi.at/wp-content/themes/kriesi/images/logo.png"; } return $logo; }
It will display different logo on a page with id 59. You can right click on Chrome or Firefox to inspect elements to find page ID’s http://i.imgur.com/HyPTCRg.jpg
Best regards,
YigitAugust 28, 2014 at 1:53 am #310160Thanks, that will work for the pages. Is there a way to add to this so portfolio pages that are part of a certain category (say a category called “baking”)… there is about 100 so hoping there is an easier way than writing out all the post-ids.
August 28, 2014 at 1:54 am #310161oh and if I have multiple pages do I just put a comma after each number? e.g if( is_page( 59, 37, 124 ) )
August 28, 2014 at 5:22 am #310209Hi!
For multiple pages the conditional should be like this:
if( is_page( array( 59, 37, 124 ) ) )
Best regards,
JosueAugust 28, 2014 at 5:56 am #310226Thanks… and the porfolio categories?
August 28, 2014 at 6:01 am #310229You can use is_category for a particular category or is_archive to affect all categories and tags pages:
if( is_page( array( 59, 37, 124 ) ) || is_archive() || is_category( array( 2, 3, 5 ) ) )
August 28, 2014 at 6:02 am #310232Thanks so much, really appreciate your help.
August 28, 2014 at 6:04 am #310233You are welcome, always glad to help :)
Regards,
JosueSeptember 1, 2014 at 3:04 am #311631Hi, the is_category and is_archive is not working… does it matter if the portfolio items I want the different logo are part of multiple categories?
Here is the code I am using, however all the portfolio items in category 261 are also in other categories.function av_change_logo($logo)
{
if( is_page( array( 4098, 4127, 4132, 4117, 4121 ) ) || is_archive( 261 ) || is_category( 261 ) )
{
$logo = “http://www.logourl.com”;
}
return $logo;
}September 1, 2014 at 4:47 am #311643Try with in_category().
September 1, 2014 at 5:12 am #311655nope no luck, the is_archive is working tho.
What if I was to list the portfolio id’s – would it look something like this:if( is_page( array( 4098, 4127, 4132, 4117, 4121 ) ) || is_archive( 261 ) || is_post( array( 4365, 4364, 4363, 4362, 4361, 4360, 4359, 4358, 4357, 4356, 4355, 4354, 4353, 4352, 4351, 4350, 4349, 4348, 4347, 4340 )))
September 1, 2014 at 5:15 am #311657No, you’ll need to use is_single:
http://codex.wordpress.org/Function_Reference/is_singleSeptember 1, 2014 at 7:00 am #311677Thanks
-
AuthorPosts
- The topic ‘change logo on certain pages’ is closed to new replies.