WordPress.org

Ready to get started?Download WordPress

Forums

Displaying the current month (9 posts)

  1. skeen
    Member
    Posted 9 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
    Member
    Posted 9 years ago #

    So, whats your question? :)

  3. skeen
    Member
    Posted 9 years ago #

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

  4. prostoalex
    Member
    Posted 9 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
    Member
    Posted 9 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
    Member
    Posted 9 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.

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

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

    <?php
    endforeach;
    ?>

  7. skeen
    Member
    Posted 9 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
    Member
    Posted 9 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
    Member
    Posted 8 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:

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

    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

Tags

No tags yet.