WordPress.org

Ready to get started?Download WordPress

Forums

Display Posts Shortcode
[resolved] Unable to see thumbnail even image tag is missing, plz help! (5 posts)

  1. raheelayub
    Member
    Posted 2 years ago #

    The overall plugin is good it is fulfilling my requirements except one issue please follow URL below to see what problem I am facing.

    http://screencast.com/t/5kggSbIMk

    I will appreciate if you reply as soon as possible.

    Thanks

    http://wordpress.org/extend/plugins/display-posts-shortcode/

  2. Bill Erickson
    Member
    Plugin Author

    Posted 2 years ago #

    Do you have an image selected for that post in the Featured Image metabox of the Edit Post screen? Here's information on how to do it: http://en.support.wordpress.com/featured-images/#setting-a-featured-image

    But I don't like how the plugin is currently putting an empty <a href="... if there isn't an image. I've just updated the plugin to only display the image code if an image size is specified AND the post has a thumbnail.

  3. borisgutierrez1
    Member
    Posted 2 years ago #

    Bill. Is there a way to display an image size in smaller size than thumbnail?

  4. Bill Erickson
    Member
    Plugin Author

    Posted 2 years ago #

    I think you should be able to. In functions.php do something like:

    add_image_size( 'be_small', 100, 50, true );

    Then use 'be_small' as your image size.

    I haven't tried it though.

  5. changyeon
    Member
    Posted 2 years ago #

    hi Bill...
    I'm wordpress beginner and programming is poor and korean.
    I appreciate your effort...and I love your plugin "Display Posts Shortcode"
    I'd like to use attatched image(not featured image) as thumbnail image
    So I modified your code as bellow...

    my result site: http://chang04.wku.ac.kr
    source code : http://image.wku.ac.kr/2011/12/display-posts-shortcode-modified.php.txt

    ===============================
    original code: 124 line
    ===============================
    if ( $image_size && has_post_thumbnail() ) $image = ''. get_the_post_thumbnail($post->ID, $image_size).' ';

    ===============================
    modified code: 124 line
    ===============================
    $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
    if ( $images ) { $total_images = count( $images );}
    $theImage = array_shift( $images );
    $image_img_tag = wp_get_attachment_image( $theImage->ID, 'thumbnail' );

    if ( $image_size && $image_img_tag ) $image = '<div class="gallery-thumb">'. $image_img_tag.'</div> ';

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic