WordPress.org

Ready to get started?Download WordPress

Forums

List category posts
Using lightbox2 with featured image thumbnails (1 post)

  1. broken196
    Member
    Posted 2 years ago #

    I've been on what has turned into a crusade tonight trying to figure out how to make my post thumbnails open in a lightbox as an image and not the actual post(it actually doesn't load the post, but attempts). After many failed attempts I figured I'd try to replace the post url with a custom value from my custom field. I found later that if I want to use a custom field I need to specify both the name and value. However I'm trying to have the lightbox open a unique image via the custom fields.

    I've been trying to work with replacing the "get_permalink($single->ID)" with something that is more controllable and that's an image and not a post.

    public function get_thumbnail($single, $lcp_thumb_class = null){
            if ($this->params['thumbnail']=='yes'){
                $lcp_thumbnail = '';
                if ( has_post_thumbnail($single->ID) ) {
    
                  if ( in_array( $this->params['thumbnail_size'], array('thumbnail', 'medium', 'large', 'full') ) ) :
                    $lcp_thumb_size = $this->params['thumbnail_size'];
                  elseif ($this->params['thumbnail_size']):
                    $lcp_thumb_size = explode(",", $this->params['thumbnail_size']);
                  else :
                    $lcp_thumb_size = 'thumbnail';
                  endif;//thumbnail size
    
                  $lcp_thumbnail = '<a rel="lightbxox" href="' . get_permalink($single->ID).'">'; 
    
                  $lcp_thumbnail .= get_the_post_thumbnail(
                                      $single->ID,
                                      $lcp_thumb_size,
                                      ($lcp_thumb_class != null) ? array('class' => $lcp_thumb_class ) : null
                                    );
                  $lcp_thumbnail .= '</a>';
    
                }
                return $lcp_thumbnail;
            } else {
                return null;
            }
        }

    Any assistance would be greatly appreciated. I hope someone else has attempted this and succeeded!! :)

    http://wordpress.org/extend/plugins/list-category-posts/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic