• Resolved baia

    (@baia)


    I add add_image_size( ‘mysize’, 300, 250, true ); to my function.php and call the_post_thumbnail(‘mysize’); in my loop.php. After that I uploaded featured images to my posts, yet no image appears when I visit the site.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Review Post_Thumbnails.

    Thread Starter baia

    (@baia)

    I reviewed it again, but I still can’t see what’s wrong with my code..

    Moderator keesiemeijer

    (@keesiemeijer)

    Is something like this in your functions.php?

    if ( function_exists( 'add_theme_support' ) ) {
    	add_theme_support( 'post-thumbnails' );
            set_post_thumbnail_size( 150, 150 ); // default Post Thumbnail dimensions
    }
    
    if ( function_exists( 'add_image_size' ) ) {
    	add_image_size( 'mysize', 300, 250, true );
    }

    Do you have something like this inside the loop in your theme’s template files?

    <?php
    if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
      the_post_thumbnail('mysize');
    }
    ?>
    <?php the_content(); ?>

    Did you put that in the right template file? What file did you put it in?

    Can you put the full content of the template file you are using to show the thumbnails in the pastebin and link back to it here

    Thread Starter baia

    (@baia)

    Yes I did these things in the right places but without if() statements and now it works !!

    I don’t understand why it did not work though. The if ( function_exists( ‘add_image_size’ ) ) is true because this function exists in my twentyten default theme. Same with the if ( has_post_thumbnail() ) statement.

    If these if() statements are true anyway, my code should work without them isn’it ? Yet it doesn’t o_O

    Thread Starter baia

    (@baia)

    Actually it does. Thanks for your help and I advise myself to stop drinking so much orange juice.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Featured image doesn't appear’ is closed to new replies.