[Resolved] Modify images links in categories pages

Home Forums Support [Resolved] Modify images links in categories pages

Home Forums Support Modify images links in categories pages

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1486346
    byo

    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

    #1487103
    Tom
    Lead Developer
    Lead Developer

    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 ๐Ÿ™‚

    #1487126
    byo

    It is working
    Thanks a lot Tom

    #1487267
    Tom
    Lead Developer
    Lead Developer

    You’re welcome ๐Ÿ™‚

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.