Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1237708

    Hello,

    I am using some code for the chid themes function.php file to make the logo different on each page.

    However in doing so I have to target each page with the page ID in the coe. Ok simple enough, but I am using the home page to display posts and it returns the page id of the first post not the page itself and as such the logo doesn’t show on the home page. How can I set the ID for that kind of home page? See below 160 ia actually the first post id. I suppose I could set the home page to a static page and use the blog layout item, although that defaults to three posts and I would need to be Abel to set the number of posts higher.

    // Change Logo image
    add_filter(‘avf_logo’,’av_change_logo_img’);

    add_filter(‘avf_logo’,’av_change_logo’);
    function av_change_logo($logo)
    {
    if( is_page(160) ) {
    $logo = “https://newsite.visionarycreativity.com/wp-content/uploads/2020/08/banner-1.jpg”;
    } elseif ( is_page(10) ) {
    $logo = “https://newsite.visionarycreativity.com/wp-content/uploads/2020/08/banner-2.jpg”;
    }

    return $logo;
    }

    Thanks

    #1238083

    Hey tonyiatridis,

    You should be able to check if the page is home, and only run the code if it’s not. Something like this:

    // Change Logo image
    add_filter('avf_logo','av_change_logo_img');
    
    add_filter('avf_logo','av_change_logo');
    	function av_change_logo($logo) {
    		if(! is_front_page()) {
    			if( is_page(160) ) {
    					$logo = "https://newsite.visionarycreativity.com/wp-content/uploads/2020/08/banner-1.jpg";
    				} elseif ( is_page(10) ) {
    						$logo = "https://newsite.visionarycreativity.com/wp-content/uploads/2020/08/banner-2.jpg";
    				}
    		}
    	}

    Best regards,
    Rikard

    • This reply was modified 4 years, 3 months ago by Rikard.
    #1238640

    Hi Rickard,

    For whatever reason the home page always defaults to the site title in the header with no graphic. I think a different strategy is to use the blog layout item on the home page and target it’s number in the php. However that defaults to just 3 post per page. Is there a way with some code to change the number of default posts up to say, five when using the blog layout item on the home page?

    Thanks

    #1238642

    Sheesh. Scratch that idea for now. Is there any out of the box way to load random images in the header as the logo? Client keeps changing things up on me.

    #1238651

    Hi,

    Unfortunately this is not possible without some core theme file customization. You would need a freelancer.

    Best regards,
    Jordan Shannon

    #1238681

    Yeah I figured as much. Thanks for the feedback though.

    :)

    #1238688

    Hi,

    No problem. Did you need additional help with this topic or shall we close?

    Best regards,
    Jordan Shannon

    #1238713

    mark it case closed, thanks

    #1238715

    Hi,

    If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘different headers (full width logos) for different pages – page ID issue’ is closed to new replies.