• WP 2.1

    I’ve searched for a really long time trying to find a solution to this, but haven’t been able to find exactly what I’m looking for.

    I would like the solution to output something similar to:

    Category Title
    Post Title 1
    Post Title 2
    (up to 5 titles)

    With the posts under “category title” coming from a specific, though changeable, month.

    I thought I might be able to use a combination of the following code with some other code, but as of now, I’m not sure if that’s possible, or what that other code might be:

    <?php
    $myposts = get_posts('numberposts=5&offset=1&category=3');
    foreach($myposts as $post) :?>
    
    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    <?php endforeach; ?>

    Any help is appreciated.

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

    (@aaaaa1)

    I still haven’t found a solution, but is there a way to use something along the lines of:
    if: April
    then: show X number of posts from Category A
    else: show X number of posts from Category A from all previous months?

    <h2>Category name</h2>

      <?php global $post;
      $myposts = get_posts(‘numberposts=15&category=’.$cat);
      foreach($myposts as $post) :
      setup_postdata($post);
      ?>

    • “><?php the_title(); ?>
    • <?php endforeach; ?>

      I hope this can help. Work’s for me.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘List post titles by category and month’ is closed to new replies.