Post Thumbnail / image

Discussion in 'WordPress' started by MikeDelta, Nov 23, 2012.

  1. #1
    Hi all. I used Wordpress 3+ version. On the home page, i don't want to have the picture or thumbnail, but only when I go there inside the article. I found some useful code, but it is for Thumbnail and don't for image, or i think it wrong?

    First in index.php
    <?php the_post_thumbnail(); ?>

    The second in functions.php

    <?php

    if (function_exists('add_theme_support')) {
    add_theme_support('post-thumbnails');
    set_post_thumbnail_size('medium'));
    }
    ?>

    <?php
    // If WordPress 2.9 or above and a Post Thumbnail has been specified
    if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) {
    the_post_thumbnail('medium', array('class' => 'post-thumbnail', 'alt' => ''.get_the_title().''));
    }
    // Or if a custom field post image has been specified
    else if (get_post_meta($post->ID, 'post_image_value', true)) {
    $postimage = get_post_meta($post->ID, 'post_image_value', true);
    echo '<img src="'.$postimage.'" alt="'.get_the_title().'" class="post-thumbnail" />';
    }
    ?>

    if i add this code to function.php, i will solve my problem?


    add_filter( 'post_thumbnail_size', 'my_post_image_size' );
    function my_post_image_size( $size )
    { $size = 'medium'; return $size; }

    Thanks in advanced
     
    MikeDelta, Nov 23, 2012 IP