Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #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.

    #309893

    Hey 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,
    Yigit

    #310160

    Thanks, 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.

    #310161

    oh and if I have multiple pages do I just put a comma after each number? e.g if( is_page( 59, 37, 124 ) )

    #310209

    Hi!

    For multiple pages the conditional should be like this:

    if( is_page( array( 59, 37, 124 ) ) )
    

    Best regards,
    Josue

    #310226

    Thanks… and the porfolio categories?

    #310229

    You 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 ) ) )
    
    #310232

    Thanks so much, really appreciate your help.

    #310233

    You are welcome, always glad to help :)

    Regards,
    Josue

    #311631

    Hi, 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;
    }

    #311643

    Try with in_category().

    #311655

    nope 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 )))

    #311657

    No, you’ll need to use is_single:
    http://codex.wordpress.org/Function_Reference/is_single

    #311677

    Thanks

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘change logo on certain pages’ is closed to new replies.