Displaying the current month (9 posts)

  1. skeen
    Posted 11 years ago #

    Hi everyone,

    I am using WordPress for an online magazine. Each month is considered a new "issue". So, what I would like to do is display the current month outside the loop. This way, I could create something at the top saying "January Issue" etc...and users could browse between the "Issues" by simply going to a different monthly archive.

  2. Erwin
    Posted 11 years ago #

    So, whats your question? :)

  3. skeen
    Posted 11 years ago #

    ...what I would like to do is display the current month outside the loop.

  4. prostoalex
    Posted 11 years ago #

    How are the articles posted? Once a month or many times a month?

    Default WordPress install features a monthly archive on the sidebar, perhaps you could just use those links, and paste them in header/footer, or wp-comments.

  5. skeen
    Posted 11 years ago #

    The articles are posted regularly. But, I want my website to be in a monthly format. I want the main page to display articles only from that month. The only navigation on the site will be to monthly archives...

    So, basically...you can only browse by month. And each "page" is compiled of articles from whatever month.

    Any help in acheiving this would be greatly appreciated.

  6. Joshua Sigar
    Posted 11 years ago #

    I suppose you don't want "January" to show up when the calendar says January 1st. You want "January" to show up when you already post an article dated in January.

    The solution is to have another loop that will grab the latest article and display the month only.

    $latest = get_posts( 'numberposts=1' );
    foreach ( $latest as $post ) :

    <?php the_time( 'F' ); ?>


  7. skeen
    Posted 11 years ago #

    alphaoide, that really rocks...it displays the month of the most recent posting. :) Thanks a lot for that!

    Now...is there any way display post made within the month? Im surprised this option isn't available in the Control Panel...

    Edited: one more thing...how do I return the month of a monthly archive page? I noticed that the global variable "m" is used, ie. index.php?m=200501 -- is there a script that will convert the value of "m" into a month name?

  8. sadish
    Posted 11 years ago #

    try this....

    <?php if ($posts) {
    $post = $posts[0];
    $latest_month = the_time('Yd', false);
    echo "<h2>";
    echo the_time('F').' Edition';
    echo "</h2>";
    $posts = query_posts($query_string . '&m='.$latest_month);
    <?php foreach ($posts as $post) : start_wp(); ?>

    compare with the original and insert the part between if ($posts) and foreach, using this code sample

  9. ederic
    Posted 10 years ago #

    My e-zine is published twice a month. Could there be a way to publish on the frontpage only the articles from, say, September 1-15, 2005?

    Also, I'd like my URL to look like this:


    or, say

    http://www.tinig.com/v10/editorial.php, where v10 = issue number 10

    Would be happy to receive your feedback. :)

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.