• Resolved polymaze

    (@polymaze)


    Hello,

    In WordPress 3, is there a way to link a post thumbnail directly to the location of a full size image inside the same post?

    I’m looking at making a dynamic lightbox-enabled thumbnail gallery page from posts of different categories, but am confused on how to make them open to a full sized image view.

    Thank you,

Viewing 1 replies (of 1 total)
  • Thread Starter polymaze

    (@polymaze)

    Nevermind, I found the function needed to achieve this from https://webdeveloperplus.com/

    function catch_that_image() {
      global $post, $posts;
      $first_img = '';
      ob_start();
      ob_end_clean();
      $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
      $first_img = $matches [1] [0];
    
      if(empty($first_img)){ //Defines a default image
        $first_img = "/images/default.jpg";
      }
      return $first_img;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘thumbnail link’ is closed to new replies.