I need to link from the portfolio grid to articles on my client’s sites from both the image AND the title. (Out of the box, the link is on the image only, which is not intuitive.) I found the following code in the forum. It works, except that it links to the permalink on my site, not to the Custom Link I set to the source documents on my various client sites. Can you please let me know how to modify this to get the custom link (external) instead of the title link (internal) returned? Thank you!
—
function my_custom_title_link( $title_link, $entry )
{
if( ! empty( $title_link ) )
{
return $title_link;
}
$title_link = get_permalink( $entry->ID );
return $title_link;
}
add_filter( ‘avf_portfolio_title_link’, ‘my_custom_title_link’, 10, 2 );
Hey CatherineTurner,
Thank you for using Enfold.
Please replace the filter with the following code.
function avf_portfolio_title_link_mod( $title_link, $entry )
{
if( ! empty( $title_link ) )
{
return $title_link;
}
$title_link = get_post_meta( $entry->ID ,'_portfolio_custom_link', true) != "" ? get_post_meta( $entry->ID ,'_portfolio_custom_link_url', true) : get_permalink( $entry->ID );
return $title_link;
}
add_filter( 'avf_portfolio_title_link', 'avf_portfolio_title_link_mod', 10, 2 );
Best regards,
Ismael
Thanks for the code, Ismael! You guys are wonderful :)
Hi,
Glad that Ismael helped you. Thanks for using Enfold :)
Best regards,
Nikko