Tagged: different logos
-
AuthorPosts
-
August 22, 2017 at 9:36 am #842381
Hi all,
I managed it to set different Logos on my Site with Advanced Custom Fields, this works perfectly. Now I also want set different Links on these Logos. I found the following code in a thread:
add_filter('avf_logo_link','av_change_logo_link'); function av_change_logo_link($link) { if(is_page(1)) { $link = "http://kriesi.at"; } if(is_page(2)) { $link = "http://kriesi.at/themes"; } return $link; }
This is what I need, but I want to replace the “is_page” with the filename of an image. How do I have to change this code for this?
Many thanks
- This topic was modified 7 years, 4 months ago by owls_studio.
August 22, 2017 at 12:42 pm #842479Hey owls_studio,
I don’t think there is a code for that, you can refer to wordpress’ codex for the conditional tags you can use: https://codex.wordpress.org/Conditional_Tags
Best regards,
NikkoAugust 22, 2017 at 1:01 pm #842502Ok thanks. So another question: Is it possible to replace this code
{ if(is_page(1)) { $link = "http://kriesi.at"; } if(is_page(2)) { $link = "http://kriesi.at/themes"; } return $link; }
with another PHP-Code?
I want to add a filter like this
add_filter('avf_logo_link','av_change_logo_link'); function av_change_logo_link($link)
with a PHP Snippet like
<?php if (file_exists($filename)) { echo '<a href="$link_address">Link</a>'; } elseif (file_exists($filename) { echo '<a href="$link_address">Link</a>'; } ?>
August 22, 2017 at 1:16 pm #842519This is my Idea:
add_filter('avf_logo_link','av_change_logo_link'); function av_change_logo_link($link) { if(wp_attachment_is_image(your_image.jpg)) { $link = "your_link"; } if(wp_attachment_is_image(your_image.jpg)) { $link = "your_link"; } }
but then allways the current Site appears as Homelink. I don’t see the problem here.
- This reply was modified 7 years, 4 months ago by owls_studio.
August 22, 2017 at 8:18 pm #842747Hi,
I don’t think those codes will work, however since you mentioned you have managed to set different logos using ACF, I think you should be able to do the same the logo link using same method (with ACF) and tweaks in header.php
Best regards,
Nikko -
AuthorPosts
- You must be logged in to reply to this topic.