• When I first created my site, I automatically made sure that all images had no links (image_default_link_type = none). Now I’ve done Lightbox, so I need to make all the images in all the posts clickable.

    I was looking for a solution on the Internet, but I could not find it. I ask for help! Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello Applestage,

    Do you want to open the image and zoom it when you click on it??

    Thread Starter AppleStage

    (@applestage)

    When I first created my site, I automatically made sure that all images had no links (image_default_link_type = none). Now I’ve done Lightbox, so I need to make all the images in all the posts clickable.

    I need to translate all the images in all posts from the view:

    <img src="https://example.com/wp-content/uploads/2018/04/Apple-iPhone-6-0.jpg" alt="" width="1500" height="1000" />

    at

    <a href="https://example.com/wp-content/uploads/2018/04/Apple-iPhone-6-0.jpg"> <img src="https://example.com/wp-content/uploads/2018/04/Apple-iPhone-6-0.jpg" alt="" width="1500" height="1000" /> </a>

    How can I do that?

    There is a function:

    add_filter ('the_content', 'del_image_link');
    function del_image_link ($ content) {
    ? $ content =
    ? preg_replace (array ('{a [^>] *> <img}', '{/> </a>}'), array ('<img', '/>'), $ content);
    ? return $ content;
    }

    It works in reverse order, that is, it makes absolutely all images with links non-sticky. I need to achieve the opposite effect.

    • This reply was modified 6 years, 8 months ago by AppleStage.
    • This reply was modified 6 years, 8 months ago by AppleStage.
    • This reply was modified 6 years, 8 months ago by AppleStage.
    • This reply was modified 6 years, 8 months ago by AppleStage.
    • This reply was modified 6 years, 8 months ago by AppleStage.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to make all images clickable? (In posts)’ is closed to new replies.