-
AuthorPosts
-
December 15, 2013 at 8:59 pm #200497
Hi,
I have created a custom field for posts called ‘external_url’.
Is there a way to wrap url in this field around the featured image, so clicking the featured image will take the user to the external site rather than showing a larger version of the featured image?kindest regards,
PPCHound
December 16, 2013 at 9:16 am #200595Hey PPCHound!
Yes – open up /wp-content/themes/enfold/includes/loop-index.php and replace
//on single page replace the link with a fullscreen image if(is_singular()) { $link = avia_image_by_id(get_post_thumbnail_id(), 'large', 'url'); }with
//on single page replace the link with a fullscreen image if(is_singular()) { $link = avia_image_by_id(get_post_thumbnail_id(), 'large', 'url'); } $external_link = get_post_meta($the_id, 'external_url'); if($external_link) $link = $external_link;Cheers!
PeterDecember 16, 2013 at 5:33 pm #200710Hi Peter,
Many thanks for your reply.
I tried your code change, and the expected url contained within the custom field was not applied. Instead received
<a href="Array"><img /></a>Seems to see the external_url as an array. Hmm … Any thoughts appreciated.
kindest regards,
PPCHound
-
This reply was modified 11 years, 11 months ago by
PPCHound.
December 17, 2013 at 6:00 am #200960Hi,
Can you create an administrator account and post it here as a private reply?
Regards,
JosueDecember 17, 2013 at 1:19 pm #201070This reply has been marked as private.December 17, 2013 at 6:53 pm #201226This reply has been marked as private.December 17, 2013 at 7:24 pm #201248This reply has been marked as private.December 17, 2013 at 8:00 pm #201260Using the code Peter provided, i just modified this line:
if($external_link) $link = $external_link;To this:
if($external_link) $link = $external_link[0];So it will get the first item of the Array.
Best regards,
JosueDecember 17, 2013 at 8:21 pm #201264This reply has been marked as private. -
This reply was modified 11 years, 11 months ago by
-
AuthorPosts
- The topic ‘Post Featured Image links to external URL?’ is closed to new replies.
