How to exclude or not to show Last Post in Category with (query_posts) on Index
-
People here and leave my question is: How to exclude or not to display the Last Post published in a category with (query_posts)? and to use the same code and bug duplicated 2s times, now I want you to show me the last post published and the other post-last show that none of the 2s show the same post. I used the post randon variant but always in some cases, I will display the same post and that’s what I do not. Of course, below I show you the code to bug I mean, these are the Arthemia Theme:
<div id="headline" class="left"> <?php query_posts("showposts=1&category_name=Especiales"); ?> <?php while (have_posts()) : the_post(); ?> <h3 class="cat_title"> <?php the_category(', '); ?> »</h3> <div class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></div> <div class="meta"><?php the_time('j M Y') ?> | <?php comments_popup_link('<div class="genericon genericon-chat"></div> +', '<div class="genericon genericon-chat"></div> 1', '<div class="genericon genericon-chat"></div> %');?></div> <?php $values = get_post_custom_values("Image");?> <a class="left" href="<?php the_permalink() ?>" rel="bookmark" title="Enlace a <?php the_title(); ?>"> <img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>&w=250&h=200&zc=1&q=100" alt="<?php the_title(); ?>" class="left" width="250px" height="200px" /></a> <?php the_excerpt(); ?> <a class="left" href="<?php the_permalink() ?>" rel="bookmark" title="Enlace a <?php the_title(); ?>">Leer más »</a> <?php endwhile; ?> </div> <div id="headline" class="right"> <?php query_posts("showposts=1&excludeposts=1&orderby=rand&category_name=Especiales"); ?> <?php while (have_posts()) : the_post(); ?> <h3 class="cat_title"> <?php the_category(', '); ?> »</h3> <div class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></div> <div class="meta"><?php the_time('j M Y') ?> | <?php comments_popup_link('<div class="genericon genericon-chat"></div> +', '<div class="genericon genericon-chat"></div> 1', '<div class="genericon genericon-chat"></div> %');?></div> <?php $values = get_post_custom_values("Image");?> <a class="left" href="<?php the_permalink() ?>" rel="bookmark" title="Enlace a <?php the_title(); ?>"> <img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>&w=250&h=200&zc=1&q=100" alt="<?php the_title(); ?>" class="left" width="250px" height="200px" /></a> <?php the_excerpt(); ?> <a class="left" href="<?php the_permalink() ?>" rel="bookmark" title="Enlace a <?php the_title(); ?>">Leer más »</a> <?php endwhile; ?> </div>
- The topic ‘How to exclude or not to show Last Post in Category with (query_posts) on Index’ is closed to new replies.