1

is there php code for next and previous year,month,day link in archive page i just need something like that

<-previous [year] next->
<-previous [month] next->
<-previous [day] next->

im creating a calendar and need those .

3
  • Have you tried anything already? Jun 15, 2015 at 9:12
  • Unfortunately no Jun 15, 2015 at 9:22
  • 1
    Like your honesty. Just an idea, why don't you use the build in calendar widget as base for yours Jun 15, 2015 at 11:01

1 Answer 1

-1

thank u all i just did a simple code to get what i want

<?php 
$prevyear = date('2150') - 0001;
$nextyear = date('2150') + 0001;
$prevmonth = date('01') - 01;
$nextmonth = date('01') + 01;
echo echo get_year_link($prevyear)."<br />".get_year_link($nextyear)."<br />".get_year_link($prevmonth)."<br />".get_year_link($nextmonth)."<br />";
?>
2
  • 2
    Could you explain why is this good solution? Jun 18, 2015 at 4:10
  • It's not a good solution. This assumes there always will be post for every month going backwards and forever in time until infinity.
    – Daniel
    Aug 31, 2017 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.