WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Thumbnail All Display Same Image (10 posts)

  1. il1cit
    Member
    Posted 2 years ago #

    Hello forum,

    Sorry for the inconvenience, I usually work things out with the information that is already provided from wordpress (and thank you for that), but this time I've searched and debugged but the problem is still there.

    The only info I've found was this:

    http://en.forums.wordpress.com/topic/thumbnail-all-display-same-image

    The thumbnails on the blog page display the same image even though the slideshow works fine and if you click on the thumbnail it goes to the correct image.

    I'm having the exact same problem, anyone else? Is there a way to fix this yet? Or another plugin I can use for the thumbnail effect?

    Thank you for your help.

  2. keesiemeijer
    moderator
    Posted 2 years ago #

    If this is a wordpress.com site, please inquire at http://en.forums.wordpress.com/

    More information is needed before anyone can help. Please provide a link to the page in question and a link to your theme if possible.

  3. il1cit
    Member
    Posted 2 years ago #

    Thank you for the quick response.

    Sorry, I missed the .com / .org difference, so I will give more detailed information about my problem.

    I can't provide a link from the site itself because it's localhosted, and the theme I'm currently building it from scratch so no link for that either :\

    The problem is simple to explain though: I'm using the thumbnail wordpress system, and upload different thumbnails for each article. What happens is that they all display the same thumbnail.

    Check here for visual aid: http://imageshack.us/photo/my-images/684/articleproblem.png/

    The code I'm using is the following:

    functions.php

    add_theme_support('nav-menus');
    if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
    	add_theme_support( 'post-thumbnails' );
    	set_post_thumbnail_size( 127, 85, true); // Normal post thumbnails
    	add_image_size('guia', 389, 521, true); // Permalink thumbnail size
    }

    the article module in index.php

    <?php
    $post_id = 73;
    $queried_post = get_post($post_id);
    if ( has_post_thumbnail( $post_id ) ) {
    the_post_thumbnail();
    }
    ?>
    <p><?php echo $queried_post->post_content; ?></p>
    <?php echo $queried_post->post_title; ?>

    (I'm using this last code to fetch a specific article)

    Thank you so much for your help!

    [Please post code snippets between backticks or use the code button.]

  4. keesiemeijer
    moderator
    Posted 2 years ago #

    Can you paste and submit the full code of index.php of your theme into a pastebin.com and post the link to it here? see the Forum Rules for posting code and using the pastebin.

  5. il1cit
    Member
    Posted 2 years ago #

    index.php through pastebin.com

    http://pastebin.com/1dFsjcB0

    The problem is in the #artwrap div (which is the wrapper for the articles). I have four specific articles that I want to show, and they are divided by the divs #artwrap1, #artwrap2, #artwrap3 and #artwrap4.

    As you can see I use the method above to get each of those articles, the only thing changed is the $post_id. The content loads fine, but the thumbnails are all the same. When I open the article page though, they all appear with the proper image and not the same one.

    Thank you for your help, let me know if there's anything else you need to see.

  6. keesiemeijer
    moderator
    Posted 2 years ago #

    Try changing the_post_thumbnail() to get_the_post_thumbnail [untested]:

    if ( has_post_thumbnail( $post_id ) ) {
    echo get_the_post_thumbnail($post_id, 'thumbnail');
    }

    http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail

  7. il1cit
    Member
    Posted 2 years ago #

    You sir, are awesome! Displaying the correct images now.

    However, these images are now in their default size and not in the size I've defined in the functions.php file through this line:

    set_post_thumbnail_size( 127, 85, true);

    How can I fix this?

    Thank you so much for your help. Give me your paypal account and I'll buy you a beer for your work :)

  8. keesiemeijer
    moderator
    Posted 2 years ago #

    try it without the "thumbnail" parameter:

    echo get_the_post_thumbnail($post_id);
  9. il1cit
    Member
    Posted 2 years ago #

    And that does it! Thank you very much for your help!

  10. keesiemeijer
    moderator
    Posted 2 years ago #

    No problem. Glad you got it resolved.

Topic Closed

This topic has been closed to new replies.

About this Topic