Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author DefProc

    (@defproc)

    It adds rel=”lightbox” when the page is rendered, so it should be one of the last things to happen.

    Do you have an example page or some code that I could see so I understand what you’re attempting? (email [email protected] if you’d rather it be private)

    Thread Starter Stealth1

    (@stealth1)

    [ Moderator note: please wrap code in backticks or use the code button. ]

    <?php if (
    (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { /* if post has a thumbnail */ ?>
    
    <?php
    the_post_thumbnail('post-thumb', array('class' => 'post-thumb')); ?>
    <?php } ?>

    -this code is at single post php of my theme
    the 1st php code: is a checker for thumbnail existing on the post
    the 2nd php code: calls the thumbnail in the specified post
    (this is where I want to insert the rel =”lightbox”)

    Hoping it can work on the thumbnail(featured image on the post)
    however I tried dozens of times but still it doesn’t make slimbox the recognize the images to animate -any ideas?

    Plugin Author DefProc

    (@defproc)

    The usual reasons for lightbox failing are :

    1. Malformed html on the page. Lightbox will need a link wrapped image with an image target (add-rel-lightbox checks for the file suffix) to work as expected.
    2. The lightbox attribute is not correctly applied.
    3. Lightbox is not loaded on the page.

    From a quick look at the_post_thumbnail page you could add the lightbox attribute in post.php (and add-rel-lightbox will ignore this link when it parses):

    <?php
     if ( has_post_thumbnail()) {
       $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
       echo '<a href="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '" rel="lightbox" >';
       the_post_thumbnail('thumbnail');
       echo '</a>';
     }
     ?>

    Does that help?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘slimbox2 featured image support’ is closed to new replies.