08. Crear una Plantilla en Wordpress

08.- Crear una Plantilla en WordPress [imagenes]

08. Crear%2Buna%2BPlantilla%2Ben%2BWordpress

INTRODUCCIÓN

En este tutorial vamos a trabajar con las imágenes que nos quedaron pendientes en el tutorial anterior, ahora vamos a hacer que estas imágenes las podamos editar desde nuestro administrador de wordpress.

PROCEDIMIENTOS

1.- En el archivo functions.php agregamos

<?php
// Activando el soporte para las image_size_names_choose
if ( function_exists( 'add_theme_support' ) ) {
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 150, 150, true );
    // additional image sizes
    add_image_size( 'category-thumb'     , 340, 260, true );
    add_image_size( 'category-thumb-blog', 535, 251, true );

add_image_size( 'category-full' , 783, 290, true );}

2.- En index.php sustituimos

<a href="#" class="image featured"><img src="<?php echo get_template_directory_uri(); ?>/images/pic02.jpg" alt="" /></a>

por

                                <a href="#" class="image featured">
                                    <?php
                                    // check if the post has a Post Thumbnail assigned to it.
                                    if ( has_post_thumbnail() ) {
                                        the_post_thumbnail('category-thumb');
                                    }
                                    ?>

                                </a>

y en el area de blog por

                                <a href="#" class="image featured">
                                    <?php
                                    // check if the post has a Post Thumbnail assigned to it.
                                    if ( has_post_thumbnail() ) {
                                        the_post_thumbnail('category-thumb-blog');
                                    }
                                    ?>

                                </a>

3.- En single.php sustituimos

             <a href="#" class="image featured"><img src="<?php echo get_template_directory_uri();?>/images/pic01.jpg" alt="" /></a>

por

                            <a href="#" class="image featured">
                            <?php
                            // check if the post has a Post Thumbnail assigned to it.
                                if ( has_post_thumbnail() ) {
                                    the_post_thumbnail('category-full');
                                }
                            ?>
                            </a>

En el siguiente tutorial miraremos las paginas de los templantes

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *