Output The Featured Image in a Loop as a Linked Media Image

Instead of linking a featured image to a post permalink in a loop – here is how you can link to its original image of itself.

So above, the title and featured image is output of a post – the title has a link to the post whilst the image is linked to itself via the $large_image_url which uses the first value in the array [0] which is the src value.

Further more a lightbox CSS class name can be triggered so a bunch of featured images can be viewed in an archive loop page without going to the single post page

2 Comments

  1. Thomas on September 18, 2018 at 3:06 pm

    Thanks for sharing.
    Could you please elaborate on the last paragraph a little bit ? Thanks,
    “Further more a lightbox CSS class name can be triggered so a bunch of featured images can be viewed in an archive loop page without going to the single post page”

Leave all Comment