Tagged: portfolio grid
Hi all –
I’d like the titles of my Portfolio Grid items to have the same link that the images do.
Can this be achieved?
Thanks!
D
Hey sdigit,
Please refer to the following:
Best regards,
Jordan Shannon
Hi Jordan,
Thanks for this. I added the final block of code from that post to my child theme’s functions.php:
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 );
But still the portfolio grid titles aren’t links.
Am I missing something?
Hi,
Thank you for the update.
The title of the portfolio items are actually disabled. Are you using the excerpt as the title? You have to set the element’s Excerpt settings to “Title and Excerpt”.
Best regards,
Ismael
Thanks Ismael.
Sorry – I remember now that we’d used the excerpt as title in order to have shorter titles in the grid.
Is there any way to have the excerpt linked the way the titles normally are?
Or to have custom titles in the Portfolio Grid (different than the Portfolio Item’s actual title)?
:)
D
Hi,
I see. This is possible, but you have use a script. Try this snippet in the functions.php file.
function ava_custom_script_grid_link(){
?>
<script>
(function($) {
$('.grid-content').on('click', function() {
var image = $(this).prev('.grid-image');
window.location.href = image.attr('href');
});
})(jQuery);
</script>
<?php
}
add_action('wp_footer', 'ava_custom_script_grid_link');
Best regards,
Ismael
That did it!
Thank you Ismael!!
:)
D
Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon