Ver Mensaje Individual
  #2 (permalink)  
Antiguo 27/05/2008, 03:01
Avatar de David_dfd
David_dfd
 
Fecha de Ingreso: febrero-2005
Ubicación: Tenerife
Mensajes: 311
Antigüedad: 19 años, 2 meses
Puntos: 2
Respuesta: Ver comentarios en página inicial

Es bastante sencillo solo tienes que usar el codigo que incluye los comentarios igual que en la pagina Entrada Individual (single.php) (Depende de tu Themes)

La pagina single.php será algo parecido a esto:

Código PHP:
<?php get_header(); ?>

<div id="content"> 



    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                <div class="entry">
                <div id="post-<?php the_ID(); ?>">
                <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Enlace permanente <?php the_title(); ?>"><?php the_title(); ?></a></h2>
                <div class="postinfo">
                <h4>Enviado por: <?php the_author(', '?> </h4> <h5><?php the_time('F j, Y'); ?></h5>
                </div>
                <?php the_content('Leer toda la noticia &raquo;'); ?>
                <div class="postbot">                
                <h4><?php the_category(', '?></h4> 
                </div>
                </div></div>

<div class="entry">
    <?php comments_template(); ?>
    </div>

    <?php endwhile; else: ?>
<div class="entry">
        <p>Sorry, no posts matched your criteria.</p>
</div>
<?php endif; ?>

    </div>
<?php get_sidebar(); ?>
<?php get_footer
(); ?>
Aunque solo nos interesa esto:

Código PHP:
<div class="entry">
    <?php comments_template(); ?>
    </div>

Luego vas a editar la pagina principal de tu themes que será index.php que sera algo parecido a esta:

Código PHP:
<?php get_header(); ?>

    <div id="content">



    <?php if (have_posts()) : ?>

        <?php while (have_posts()) : the_post(); ?>
<div class="entry">
            <div id="post-<?php the_ID(); ?>">
                <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Enlace <?php the_title(); ?>"><?php the_title(); ?></a></h2>
                <div class="postinfo">
                <h4>Enviado por: <?php the_author(', '?> </h4> <h5><?php the_time('F j, Y'); ?></h5>
                </div>
                <?php the_content('Leer toda la noticia &raquo;'); ?>
                <div class="postbot">                
                <h4><?php the_category(', '?></h4> <h5><?php comments_popup_link('Deja tu comentario''1 Comentario''% Comentarios'); ?></h5>
                </div>
                </div></div>


        <?php endwhile; ?>

        <div class="navigation">
            <p><?php next_posts_link('« Noticias Anteriores'?>
            <?php previous_posts_link('| Siguientes Noticias » '?></p>
        </div>

    <?php else : ?>
<div class="entry">
        <h2>Not Found</h2>
        Sorry, but you are looking for something that isn't here.
</div>

    <?php endif; ?>
</div>
    

<?php get_sidebar(); ?>

<?php get_footer(); ?>
Como vez aqui no se muestra la parte:

Código PHP:
<div class="entry">
    <?php comments_template(); ?>
    </div>
Asi que solo tenemos que añadirla a index.php para que se muestren en la pagina principal.

Código PHP:
<?php get_header(); ?>

    <div id="content">



    <?php if (have_posts()) : ?>

        <?php while (have_posts()) : the_post(); ?>
<div class="entry">
            <div id="post-<?php the_ID(); ?>">
                <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Enlace <?php the_title(); ?>"><?php the_title(); ?></a></h2>
                <div class="postinfo">
                <h4>Enviado por: <?php the_author(', '?> </h4> <h5><?php the_time('F j, Y'); ?></h5>
                </div>
                <?php the_content('Leer toda la noticia &raquo;'); ?>
                <div class="postbot">                
                <h4><?php the_category(', '?></h4> <h5><?php comments_popup_link('Deja tu comentario''1 Comentario''% Comentarios'); ?></h5>
                </div>
                </div></div>
    <div class="entry">
    <?php comments_template(); ?>
    </div>

        <?php endwhile; ?>

        <div class="navigation">
            <p><?php next_posts_link('« Noticias Anteriores'?>
            <?php previous_posts_link('| Siguientes Noticias » '?></p>
        </div>

    <?php else : ?>
<div class="entry">
        <h2>Not Found</h2>
        Sorry, but you are looking for something that isn't here.
</div>

    <?php endif; ?>
</div>
    

<?php get_sidebar(); ?>

<?php get_footer(); ?>
Luego solo debes adaptar el comments.php para dejarlo a tu gusto.

Repito que no tiene por que ser exactamente igual, depende mucho de la plantilla, pero el codigo se ha de parecer al menos.