Archived topic
Modify images links in categories pages
3 replies · Started by byo on October 13, 2020
Hi,
My content is all located in the categories pages, in the single posts i have only a designer tool for images, so the important pages in my case are the category pages, that i need to modify.
The problem is, the file is located in "inc" folder, and it's a file i can't modify in child theme and i have no idea what code to use in functions.php file.
My question is:
How to link the featured image in category pages to it's full size image (purpose is to use a lightbox tool) ?
Thank you
Hi there,
You could try this:
add_filter( 'generate_featured_image_output', function( $output ) {
if ( ! is_category() ) {
return $output;
}
return sprintf(
'<div class="post-image">
%3$s
<a href="%1$s">
%2$s
</a>
</div>',
esc_url( get_the_post_thumbnail_url() ),
get_the_post_thumbnail(
get_the_ID(),
apply_filters( 'generate_page_header_default_size', 'full' )
),
apply_filters( 'generate_inside_featured_image_output', '' )
);
} );
Let me know :)
It is working
Thanks a lot Tom
You're welcome :)