[Support request] single post image in lightbox?

Home Forums Support [Support request] single post image in lightbox?

Home Forums Support single post image in lightbox?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #723218
    dasigna

    hi there,

    so i am searching quite a while to get a solution for this with no luck:
    the post image in single view originally has no link to it… how can i add one to the media-file to show the image in a lightbox??
    currently havin relatively small post images with fixed ratio, so i nedd to have a way to open them up in native elementor lightbox.

    any hint somebody?

    thanks in advance

    #723323
    David
    Staff
    Customer Support

    Hi there,

    can you provide a link to the site so i can see the actual setup. I am not sure if its gonna be doable using the Elementor lightbox….

    #723605
    dasigna

    hi david,

    link currently would be useless because its a dev-site.

    but what do you mean by ‘actual setup’?
    i think the blog post setup for single is always quite the same regardless of setup…?

    so let me explain another way:
    every blog post has its featured image – normally they contain a link to the specific post until the single view… then the image finally has no link at all.
    so the question is – is there a way to give the image a link to the media file (in single view) so the lightbox can grab this? the latter is no problem as the lightbox grabs all links from images set to media file.

    better to understand now??

    regards

    #723944
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    This depends. Are you using the Blog module at all? If so, are you resizing the image at all with the Customizer options?

    #724008
    dasigna

    hi tom,

    yes, using blog module.
    yes, also resizing the image to equal width/height.

    do you need more information?

    #724123
    Tom
    Lead Developer
    Lead Developer
    #724608
    dasigna

    hi tom,

    thanks for the partly great solution – works in principle, but only for a static custom link. but how do i get the mediafile link dynamically inserted for the respective single featured image?
    … replacing the “#YOUR-URL” part with the link to the full image from each single post?

    #724827
    Tom
    Lead Developer
    Lead Developer

    In that case, you would do this:

    add_filter( 'generate_single_featured_image_output', function( $output, $image_html ) {
        printf(
            '<div class="featured-image">
                <a href="%1$s">
                    %2$s
                </a>
            </div>',
            get_the_post_thumbnail_url(),
            $image_html
        );
    }, 10, 2 );
    #724989
    dasigna

    thank you tom. tried quite a time to tweak but only got white screens ๐Ÿ™‚
    this works flawlessly!

    really appreciate your support.

    #725384
    Tom
    Lead Developer
    Lead Developer

    No problem – glad I could help! ๐Ÿ™‚

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