WordPress.org

Forums

[resolved] adding a class to image links in posts (2 posts)

  1. manmar
    Member
    Posted 1 year ago #

    Is there a way to add a class to image links in posts? I am trying to open images with a lightbox while using default WP functionality (add media).

    I am tying to go from

    <a href="big-image.jpg">
      <img src="image.jpg">
    </a>

    to

    <a class="lightbox" href="big-image.jpg">
      <img src="image.jpg">
    </a>
  2. manmar
    Member
    Posted 1 year ago #

    With the help from JohanPirlouit's code on Add the title of an image to the image link in gallery I switched to using a rel attribute for the lightbox.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.