WordPress.org

Ready to get started?Download WordPress

Forums

Display Current Month Only (4 posts)

  1. audiodog
    Member
    Posted 9 years ago #

    I have no idea if anyone has asked this question before ...Is it possible to change the script, add script, or add external script, to have the initial visit display only the day's post, or month's postings? I cannot use plug-ins, so I will have to manually code or edit script. I believe that this is possible because I recoded a design which was using javascript to "pull" from ColdFusion. Or worse come to worse, if someone could point me to a link or thread which provides how to offer different starting pages, I would welcome that also. Thank you.

  2. sadish
    Member
    Posted 9 years ago #

    I had the same issue... and this code seems to have met the requirements.

    you may want to try it out...

    <?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(); ?>

    and after that anything that you normally had , holds good.

    Try it out.

  3. Jack
    Member
    Posted 9 years ago #

    This code doesn't work for me, although I also would like to have the current month that had posts as the startpage. My indexpage stays completely blank.

    I'm not so comfortable with php, but should't the code try to gain the date (month) of the latest post instead of the actual month we're in? Because if the actual month is februari 2005 it could well be empty, and the last post could have been made in januari.

  4. sadish
    Member
    Posted 9 years ago #

    The code I posted is trying to get the month from the latest post, and not the current month.
    probably you need the complete index.php file., that you can just replace it with.

    let me know, if thats the case.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.