WordPress.org

Ready to get started?Download WordPress

Forums

WordPress MU Sitewide Tags Pages
Post thumbnail support (2 posts)

  1. roryrothon
    Member
    Posted 2 years ago #

    Hi.
    I have achieved custom post type "product" with your plugin and all is displaying on the main blog great!

    But, as im dure you guessed, ive hit a problem with the thumbnails not being displayed...

    I am fully aware that the_post_thumbnail() works, but my theme has a portfolio shortcode that i am using.

    The page template uses the following:

    // get thumbnail image getcrafty
    		$thumb = get_post_thumbnail_id();
    
    		// get resized image getcrafty
    		// this will return the resized $thumb or placeholder if enabled and no $thumb
    		$image = vt_resize( $thumb, '', $imageW, $imageH, true );
    
    		// linking
    		$title = get_the_title(); // if media Title entered
    		$class = '';
    		switch (strtolower(trim($sc['link']))) {
    			case 'none':
    				$URL = '';
    				break;
    			case 'post':
    				$URL = get_permalink();
    				break;
    			case 'lightbox':
    			default:
    				$URL = wp_get_attachment_url($thumb); // original image
    				if (get_meta('media_url')) $URL = get_meta('media_url'); // if media URL entered
    				if (get_meta('media_title')) $title = get_meta('media_title'); // if media Title entered
    				$class .= 'popup';
    		}
    
    		$img = '<figure><img src="'.$image['url'].'" width="'.$image['width'].'" height="'.$image['height'].'" /></figure>';
    		if ($URL) $img = '<a href="'.$URL.'" class="'.$class.'" title="'.$title.'" rel="portfolio_'.$sc['id'].'">'. $img .'</a>';

    Is there any php gurus out there in the far reaches of cyberspace that could lend a helping hand pretty please?

    Many thanks

    http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/

  2. roryrothon
    Member
    Posted 2 years ago #

    Update for anyone who is wanting similar support.
    using the code below allows manipulation of the post thumbnail to return just the thumbnail url and not the image html, you can then pass the url through your theme easily.

    global $blog_id;
    $postlink = get_post_permalink();
    $thumbnail_id = get_the_post_thumbnail($post->ID);
    preg_match ('/src="(.*)" class/', $thumbnail_id, $link);
    $postimg = $link[1];

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.