• Resolved mallinj

    (@mallinj)


    I’m relatively new to WordPress but picking it up quickly. How can I post a thumbnail that links to the full image? I was able to do this but the full image loads as a new page/new tab. Is there a way to make it “pop out” with a simple “X” close button? Do I need a plugin for this? Which one?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thickbox.

    In your theme’s functions.php, put the following:

    function theme_queue_js(){
      if (!is_admin()){
        wp_enqueue_script('jquery');
        add_thickbox();
        wp_enqueue_style('thickbox');
    }
    add_action('get_header', 'theme_queue_js');

    Then, straight from the Thickbox docs:

    Instructions:
    * Create a link element (<a href>)
    * Give the link a class attribute with a value of thickbox (class=”thickbox”)
    * Provide a path in the href attribute to an image file (.jpg .jpeg .png .gif .bmp)

    In other words, make an anchor tag just like normal, linking it to your image, and add a class to the anchor– <a class="thickbox" href="your/image/url" >look at my cool image</a>. Unless I’ve forgotten something or made a mistake copying the code, that should work.

    There are Javascript libraries that do similar things but Thickbox is included with WordPress so it is easy to get going. Thickbox is, sadly, listed as ‘not maintained any longer’ so I’m not sure what will happen in the future.

    Thread Starter mallinj

    (@mallinj)

    Sweet. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘I want to post a thumnail in a post that pops out the full image… how?’ is closed to new replies.