• 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.

Viewing 8 replies - 1 through 8 (of 8 total)
  • So, whats your question? ??

    Thread Starter skeen

    (@skeen)

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

    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.

    Thread Starter skeen

    (@skeen)

    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.

    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.

    <?php
    $latest = get_posts( 'numberposts=1' );
    foreach ( $latest as $post ) :
    ?>

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

    <?php
    endforeach;
    ?>

    Thread Starter skeen

    (@skeen)

    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?

    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

    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:

    https://www.mydomain/issuenumber/post-slug

    or, say

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

    Would be happy to receive your feedback. ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Displaying the current month’ is closed to new replies.