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
Hey 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!
Peter
Hi 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
Hi,
Can you create an administrator account and post it here as a private reply?
Regards,
Josue
Using 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,
Josue