functions.php
For enable featured image:
add_theme_support( 'post-thumbnails', array( 'post' ) );
set_post_thumbnail_size( 200, 200, true );
add_image_size( 'small-image', 150, 150, true );
add_image_size( 'post-image', 660, 220, true );
add_theme_support( 'post-thumbnails', array( 'post' ) );
set_post_thumbnail_size( 200, 200, true );
add_image_size( 'small-image', 150, 150, true );
add_image_size( 'post-image', 660, 220, true );
Call
<?php the_post_thumbnail('small-image', array('class' => 'post-thumb')); ?>
Note: Use the above code in loop.php before <?php the_content();?> function for homepage
<?php the_post_thumbnail('post-image', array('class' => 'post-thumb')); ?>
Note: Use the above code in single.php for Post Page
With the own post link:
<a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail('small-image', array('class' => 'post-thumb')); ?></a>
Note: Use the above code in loop.php before <?php the_content();?> function for homepage
<?php the_post_thumbnail('post-image', array('class' => 'post-thumb')); ?>
Note: Use the above code in single.php for Post Page
With the own post link:
<a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail('small-image', array('class' => 'post-thumb')); ?></a>
Example
In functions.php:
add_theme_support( 'post-thumbnails', array( 'post' ) );
set_post_thumbnail_size( 200, 200, true );
add_image_size( 'single-post-image', 150, 150, true );
For many images:
if ( function_exists( 'add_theme_support' ))
add_theme_support( 'post-thumbnails' );
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'full-size', 9999, 9999, false );
add_image_size( 'small-thumb', 54, 54, true );
add_image_size( 'slider', 970, 9999, false );
add_image_size( 'post-image', 660, 220, true );
add_image_size( 'blog-thumb', 280, 92, true );
add_image_size( 'grid-thumb', 215, 140, true );
add_image_size( 'gallery-thumb', 205, 140, true );
add_image_size( 'staff-thumb', 100, 100, true );
add_image_size( 'portfolio-single', 500, 9999, false );
}
In loop.php:
<?php the_post_thumbnail('blog-thumb', array('class' => 'single-post-thumb')); ?>
add_theme_support( 'post-thumbnails', array( 'post' ) );
set_post_thumbnail_size( 200, 200, true );
add_image_size( 'single-post-image', 150, 150, true );
For many images:
if ( function_exists( 'add_theme_support' ))
add_theme_support( 'post-thumbnails' );
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'full-size', 9999, 9999, false );
add_image_size( 'small-thumb', 54, 54, true );
add_image_size( 'slider', 970, 9999, false );
add_image_size( 'post-image', 660, 220, true );
add_image_size( 'blog-thumb', 280, 92, true );
add_image_size( 'grid-thumb', 215, 140, true );
add_image_size( 'gallery-thumb', 205, 140, true );
add_image_size( 'staff-thumb', 100, 100, true );
add_image_size( 'portfolio-single', 500, 9999, false );
}
In loop.php:
<?php the_post_thumbnail('blog-thumb', array('class' => 'single-post-thumb')); ?>