Agregar miniatura de imagen al resumen del home

  • Autor Autor r2j
  • Fecha de inicio Fecha de inicio
R

r2j

Lambda
SEO
Hola betas, quisiera saber cómo puedo hacer eso. El theme lo acabo de comprar y quería agregar eso u.u
Tengo este código en functions:

PHP:
if ( function_exists( 'add_theme_support' ) ) {
	add_theme_support( 'post-thumbnails' );
	set_post_thumbnail_size( 150, 150, true );
	add_image_size('featured', 990, 335, true );
}

Tengo este index:

PHP:
<?php get_header(); ?>
	
<div id="left">
		<?php $categories = get_option_tree ('blogcategory', ''); ?>
        <?php query_posts($query_string.'&cat='.$categories.''); ?>
		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    	<div class="post" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        	<div class="posttitle">
            	<div class="commentbox"><?php if ( comments_open() ) { comments_popup_link('0', '1', '%'); } else { echo "-"; } ?></div>
                <h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
                <div class="postmeta"><span class="authorlink"><?php the_author_posts_link(); ?></span> <span class="date"><?php the_time('d M Y'); ?></span> <span class="tags"><?php if ( get_option_tree ('tagcat', 'Categories') == "Categories" ) { ?><?php the_category(', ') ?><?php } else { ?><?php the_tags('', ', ', ''); ?><?php } ?></span></div>  
       	  	</div>
          	<div class="posttext">
            <?php if ( get_option_tree ('postview', 'Full Posts') == "Full Posts" ) { ?>
				<?php the_content('Continue Reading →'); ?>
            <?php } else { ?>
                <?php the_excerpt('Continue Reading →'); ?>
            <?php } ?>
            </div>
            <div class="postend">
            	<div class="readmorediv"><a href="<?php the_permalink() ?>">read more</a></div>
            </div>
        </div>
        <?php endwhile; ?>
   		<?php else : ?>
    	<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<div id="pagination">
	<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
    <div class="totop">
    <a href="#top">Go To Top</a>
    </div>
</div>
<?php get_footer(); ?>

Y a lo mejor sirve el excerpts:

PHP:
<?php
function featured_excerpt_length($length) {
	return 16;
}
function wpe_excerptmore($more) {
    return '...';
}
function wpe_excerpt($length_callback='', $more_callback='') {
    global $post;
    if(function_exists($length_callback)){
        add_filter('excerpt_length', $length_callback);
    }
    if(function_exists($more_callback)){
        add_filter('excerpt_more', $more_callback);
    }
    $output = get_the_excerpt();
    $output = apply_filters('wptexturize', $output);
    $output = apply_filters('convert_chars', $output);
    echo $output;
}
function ShortenText($text)
	{
	$chars_limit = 22;
	$chars_text = strlen($text);
	$text = $text." ";
	$text = substr($text,0,$chars_limit);
	$text = substr($text,0,strrpos($text,' '));
	
	if ($chars_text > $chars_limit) {
		$text = $text."...";
	}
	return $text;
}
?>

He probado diversos tutoriales y no consigo que se haga bien... Invoco al poder betero!
 
en el código del index no hay nada para mostrar imagen, cambia esto

Insertar CODE, HTML o PHP:
              <div class="posttext"> 
            <?php if ( get_option_tree ('postview', 'Full Posts') == "Full Posts" ) { ?> 
                <?php the_content('Continue Reading →'); ?> 
            <?php } else { ?> 
                <?php the_excerpt('Continue Reading →'); ?> 
            <?php } ?> 
            </div>

por esto

Insertar CODE, HTML o PHP:
              <div class="posttext"> 
            <?php echo get_the_post_thumbnail(get_the_ID(), 'thumbnail', array('class' => 'alignleft')); // ESTO SE AÑADIÓ ?>
            <?php if ( get_option_tree ('postview', 'Full Posts') == "Full Posts" ) { ?> 
                <?php the_content('Continue Reading →'); ?> 
            <?php } else { ?> 
                <?php the_excerpt('Continue Reading →'); ?> 
            <?php } ?> 
            </div>
 
Atrás
Arriba