• Resolved ntlk

    (@ntlk)


    Hi there.
    I’m very new to WordPress and PHP and couldn’t find an answer to my problem in the forum.

    I am trying to get all posts from a given month to be displayed on one page (I am using for this the Masonry plugin with Infinite Scroll) when you select one of the archives in the menu.

    So far only the latest post from a given month is displayed. This is the pertinent part of my archive.php:
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="box">
    <article <?php post_class() ?>>
    <h2>ID, "url", true)) echo get_post_meta($post->ID, "url", true); else the_permalink(); ?>"><?php the_title(); ?></h2>
    <?php the_excerpt('') ?> ">Read more
    </article>
    </div><!-- end box -->
    <?php endwhile; else: ?>
    <div class="box"><?php _e('Sorry, no posts matched your criteria.'); ?></div>
    <?php endif; ?>

    I’ve tried this:
    <?php if (have_posts()) : ?>
    <?php query_posts('posts_per_page=10'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="box">
    <article <?php post_class() ?>>
    <h2>ID, "url", true)) echo get_post_meta($post->ID, "url", true); else the_permalink(); ?>"><?php the_title(); ?></h2>
    <?php the_excerpt('') ?>">Read more
    </article>
    </div><!-- end box -->
    <?php endwhile; else: ?>
    <div class="box"><?php _e('Sorry, no posts matched your criteria.'); ?></div>
    <?php endif; ?>

    And:
    <?php if (have_posts()) : ?>
    <?php
    $linksPosts = new WP_Query();
    $linksPosts->query('showposts=20&cat=all');
    ?>
    <?php while ($linksPosts->have_posts()) : $linksPosts->the_post(); ?>
    <div class="box">
    <article <?php post_class() ?>>
    <h2>ID, "url", true)) echo get_post_meta($post->ID, "url", true); else the_permalink(); ?>"><?php the_title(); ?></h2>
    <?php the_excerpt('') ?> ">Read more
    </article>
    </div><!-- end box -->
    <?php endwhile; ?>

    Unfortunately with both of the methods above my page lists ALL posts, not just the post from the month in question. How can I fix this?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying all posts from a given month on one page’ is closed to new replies.