Return to Snippet

Revision: 41414
at April 18, 2011 13:59 by Sauljps


Updated Code
// Enable support for post-thumbnails  
      
add_theme_support('post-thumbnails');  
      
    // If we want to ensure that we only call this function if  
    // the user is working with WP 2.9 or higher,  
    // let's instead make sure that the function exists first  
      
if ( function_exists('add_theme_support') ) { 
     add_theme_support('post-thumbnails');  
}  

// Insertar dentro de index.php //

<?php the_post_thumbnail(); ?>


// name of the thumbnail, width, height, crop mode
add_image_size( 'post-image',  300, 180, true ); // post image shown in main blog feed
add_image_size( 'featured-image',  652, 245, true ); // large post thumbnail shown in the Featured section
add_image_size( 'slide-image',  900, 300, true ); // really large image for the main front-page slider
add_image_size( 'slide-image-small',  200, 200, true ); // small square image shown in carousel slider in footer
add_image_size( 'latest-post-widget',  80, 80, true ); // really small square shown for latest posts widget
add_image_size( 'related-posts',  180, 180, true );  

the_post_thumbnail('post-image'); // replace post-image with the name of your thumbnail, as declared above


if(has_post_thumbnail()) {
	the_post_thumbnail('featured-image');
} else {
        // show a default image if no thumbnail is set
	echo '<img src="path/to/yourimage/jpg" />';
}

Revision: 41413
at February 17, 2011 15:20 by Sauljps


Initial Code
// Enable support for post-thumbnails  
      
add_theme_support('post-thumbnails');  
      
    // If we want to ensure that we only call this function if  
    // the user is working with WP 2.9 or higher,  
    // let's instead make sure that the function exists first  
      
if ( function_exists('add_theme_support') ) { 
     add_theme_support('post-thumbnails');  
}  

// Insertar dentro de index.php //

<?php the_post_thumbnail(); ?>

Initial URL

                                

Initial Description

                                

Initial Title
Wordpress Post-Thumbnail

Initial Tags

                                

Initial Language
PHP