Return to Snippet

Revision: 46453
at May 19, 2011 23:56 by serialk89


Initial Code
global $post;

                        $args = array('numberposts' => 3, 'offset'=> 0, 'order'=> 'DESC' );

                        $myposts = get_posts( $args );

                        foreach( $myposts as $post ) : setup_postdata($post);
                            $excerpt = get_the_excerpt();
                            add_theme_support( 'post-thumbnails' );
                            set_post_thumbnail_size( 145, 100, true ); // Normal post thumbnails
                            add_image_size( 'single-post-thumbnail', 400, 9999 ); // Permalink thumbnail size
                        ?>
                        <div class="homepostd">

                            <div class="thumbd">
                                <a title="<?php the_title(); ?>" rel="bookmark" href="<?php the_permalink(); ?>">
                                    <?php 
                                        if(has_post_thumbnail()) {
                                            the_post_thumbnail(array(145,100));
                                        } else {
                                            echo '<img src="'.get_bloginfo("template_url").'/images/img-default.jpg" width="150" height="64" />';
                                        } 
                                    ?>
                                </a>
                            </div>

                            <div class="rightcontpd">
                                <b><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></b>
                                <?php echo string_limit_words($excerpt,10);?><a href="<?php the_permalink(); ?>">[...]</a>
                            </div>

                        </div>

                        <?php endforeach; ?>

Initial URL


Initial Description
Por parámetro selecciono la cantidad de caracteres que quiero que me muestre the_excerpt() en wordpress

Initial Title
EXCERPT PERSONALIZADO LA CANTIDAD DE CARACTERES

Initial Tags
wordpress

Initial Language
PHP