• I have the following code:

    <div id="destizquierda">
    					<?php query_posts('cat=3&posts_per_page=1'); ?>
                        <?php if(have_posts()) : ?><?php while (have_posts()) : the_post(); $wp_query->is_archive = true; ?>
                            <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
                            <p><?php echo strip_tags(the_advanced_excerpt('length=500')); ?></p>
                            <p class="leer"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">Leer más</a></p>
                        <?php endwhile; ?>
                        <?php wp_reset_query(); ?>
                        <?php endif; ?>
                    </div>

    I’m trying to implement this code on archive.php in order to show the posts from a certain date. What i’m saying is that if i put the URL mysite.com/2012/01/01 I want to see the posts from that dates. I cannot do that with that code and I don’t know what I have to do. I’m using query_posts because I’m using different loops on the same page (it’s an online newspaper?

    I hope U can help me! Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter alvarols

    (@alvarols)

    I tried to do this, but nothing appears:
    <?php $current_year = date(‘Y’);
    $current_month = date(‘m’); ?>

    <div id="destizquierda">
                        <?php query_posts('cat=3&posts_per_page=1'); ?>
                        <?php if(have_posts()) : ?><?php while (have_posts()) : the_post(); $wp_query->is_archive = true; ?>
                            <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
                            <p><?php echo strip_tags(the_advanced_excerpt('length=500')); ?></p>
                            <p class="leer"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">Leer más</a></p>
                        <?php endwhile; ?>
                        <?php wp_reset_query(); ?>
                        <?php endif; ?>
                    </div>

    Thread Starter alvarols

    (@alvarols)

    ?Anyone?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘query_posts working on archive.php. How to?’ is closed to new replies.