Forum Replies Created
-
AuthorPosts
-
February 10, 2019 at 10:11 am in reply to: Different header logo for different sections of website #1065071
Hi Guenn – ‘OR’ has been working okay for me, but as per your suggestion I’ve changed it to:
||
as this looks to be more standard?!For anyone else in the same situation, this is the final code I have that accounts for logos related to other parent pages and their sub-pages if that makes sense!:
//change the logo for page and all child pages //first is the function to find all child pages function is_tree($pid) { global $post; $ancestors = get_post_ancestors($post->$pid); $root = count($ancestors) - 1; $parent = $ancestors[$root]; if(is_page() && (is_page($pid) || $post->post_parent == $pid || in_array($pid, $ancestors))) { return true; } else { return false; } }; //second is the function to change the logo, note the "is_tree" add_filter('avf_logo','av_change_logo'); function av_change_logo($logo) { if (is_tree(515) || is_singular('procurement-pages')) { $logo = "[logo url]"; } elseif (is_tree(509)) { $logo = "[logo url]"; } elseif (is_tree(530)) { $logo = "[logo url]"; } return $logo; }
Obviously you would swap [logo url] for your logo url, and the numbers such as ‘530’ would need to reflect the page id of the parent page. Thanks again to Mike for his help with this!
- This reply was modified 5 years, 9 months ago by alsterb.
February 4, 2019 at 2:52 pm in reply to: Different header logo for different sections of website #1062701Thank you Mike!
That looks to be working well – stupidly I realised one section were not child pages, but I’d manually added into the menu a load of custom post type pages, but I adjusted your code like this:
if (is_tree(515) or is_singular('procurement-pages'))
And that appears to work. I still need to sort the other pages, but I feel like I’m making progress now – thank you!
February 3, 2019 at 10:27 pm in reply to: Different header logo for different sections of website #1062414Thanks Mike – I will give that a go! Just one question – is it possible with that code to specify any sub pages of a specific page?
So something like:
add_filter('avf_logo','av_change_logo'); function av_change_logo($logo) { if(is_page(632) [or sub pages of this page??] ) { $logo = "http://kriesi.at/wp-content/themes/kriesi/images/logo.png"; } return $logo; }
Thanks, Alex
@mensmaximus – thank you, your solution has worked well!
@jordan_s – I managed to fix this using @mensmaximus’s solution, would be great if this could be implemented into future updates of enfold.I used the solution posted here:
https://kriesi.at/support/topic/enfold-theme-woocommerce-product-images-not-showing-as-of-4-4-17/page/3/#post-773385
Thanks again, Alex
@mensmaximus – thank you, I’m just reading through your posts now, I’m just updating to woo commerce 3.0.4, but I was using 3.0.1, so looks to be the same issue!
Hi Jordan,
I think your looking at them in the lists where they do look fine, but when you look at individual product pages all are using an image too small for it’s container. See the links in private below:
You’ll notice it’s selected the smallest thumb each time, the 120x120px, rather than one of the higher ones like 450x450px
Hi Jordan,
Thanks for your reply – sorry mine’s a bit late since the email from here landed in my Junk!
The suggestions you’ve posted are good, but have made no difference. Sorry I did make a typo in my question regarding catalogue images being 45 x450px – they are 450 x 450px!
The problem is that I have a div of about 400px sq, but when inspecting the attributes for the image used it’s set at 120px sq. I’ve included the source for this below (private) plus a link to the web page so you can see the issue yourself since there is a live one up online now…
It’s as if it is selecting the wrong size from srcset maybe? Like instead of using the catalogue image here that is available, it’s selecting the thumbnail. I could make the thumbnail size huge, but that would then slow down pages with lots of thumbnails…
Thanks again for your help!
- This reply was modified 7 years, 6 months ago by alsterb.
-
AuthorPosts