-
AuthorPosts
-
August 14, 2020 at 8:41 am #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
August 16, 2020 at 6:01 am #1238083Hey 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, 4 months ago by Rikard.
August 17, 2020 at 11:18 pm #1238640Hi 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
August 17, 2020 at 11:36 pm #1238642Sheesh. 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.
August 18, 2020 at 12:54 am #1238651Hi,
Unfortunately this is not possible without some core theme file customization. You would need a freelancer.
Best regards,
Jordan ShannonAugust 18, 2020 at 2:29 am #1238681Yeah I figured as much. Thanks for the feedback though.
:)
August 18, 2020 at 3:04 am #1238688Hi,
No problem. Did you need additional help with this topic or shall we close?
Best regards,
Jordan ShannonAugust 18, 2020 at 6:03 am #1238713mark it case closed, thanks
August 18, 2020 at 6:10 am #1238715Hi,
If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘different headers (full width logos) for different pages – page ID issue’ is closed to new replies.