Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/06/2012, 05:54
blogdv
 
Fecha de Ingreso: julio-2010
Mensajes: 166
Antigüedad: 13 años, 9 meses
Puntos: 0
Pregunta Index, mostrar solo entradas de hoy o de ayer si no hay posts hoy..

Buenas, tengo un wordpress con noticias y actualmente tengo configurado el index.php para mostrar únicamente las entradas publicadas hoy.

Para ello utilizo el siguiente código en el index.php:
Código:
<?php $today = getdate(); query_posts ('year=' .$today["year"] .'&monthnum=' .$today["mon"] .'&day=' .$today["mday"] .'&cat=0'); ?>
		<?php while (have_posts()) : the_post(); ?>
<h2 class="<?php echo $h2class; ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><b><u><?php the_title(); ?></u></b></a></h2>

		<?php endwhile; ?>
Me funciona así perfecto para mostrar entradas publicadas hoy, pero si un día no publico nada, en mi inicio no aparece nada, querría mostrar las entradas de hoy tal como hace dicho código pero cuando no haya entradas hoy, que muestre las de ayer hasta que hoy haya nuevas entradas..

No se si me explico pero a ver si me podríais hechar una mano con eso que debería editar en mi codigo..

Muchas gracias a todos por la ayuda!
Saludos