How to display current month and three posts from previous month? (2 posts)

  1. myownalias
    Posted 5 years ago #

    What I am looking to do is display all entries minus one category from the current month (which I already have code in place for)+ three entries from the previous month. I want to be able to do this because I sometimes don't post for a few days and would like to not have a blank home page because I don't post until the 3rd or 4th of the month! I currently have the below snippet for showing he current month only and excluding the one category as described above!

    $current_month = date('m');
    $current_year = date('Y');

    Any help would be appreciated!

  2. Michael
    Forum Moderator
    Posted 5 years ago #

    this might help:

    $last_month = date("F", strtotime("-1 month"));
    $last_year = date("Y", strtotime("-1 month")); //in case of january


Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.