Forums

Display posts on main page by month (2 posts)

  1. magically
    Member
    Posted 9 months ago #

    I made a calender/gallery type theme where the main index display the posts of the current month and viewers can browse the previous months as well. The code I used for the navigation was this:

    '<div class="navigation">

    <?php $cmonth_num_plus = $cmonth + 1; $cmonth_num_minus = $cmonth - 1; //set values for the next and previous cmonth ?>
    <?php $cmonth_check = $current_month-$cmonth; //set up a way to check the first day ?>
    <?php $start_month = 11; $start_year = 2008; //set the date that your blog starts from ?>

    <?php if($current_year >= $start_year && $cmonth_check>$start_month){ ?>
    <div id="previous">
    <?php echo 'Previous Month'; ?>
    </div>
    <?php } ?>

    <?php //if its not the current month display the 'next' link
    if($cmonth>0){ ?>
    <div id="next">
    <?php echo 'Next Month'; ?>
    </div>
    <?php } ?>

    </div>'

    But now it's not working (not displaying anymore.)

    Any help will be greatly appreciated!!!

  2. MichaelH
    moderator
    Posted 9 months ago #

    But now it's not working (not displaying anymore.)

    Very unclear what that means.

    But will ask, anything to do with this?

    <?php $start_month = 11; $start_year = 2008; //set the date that your blog starts from ?>

    Also, may be necessary to paste your whole template at a pastebin and report the link back here.

Reply

You must log in to post.

About this Topic