[resolved] get_day_link and the_time (problems) (3 posts)

  1. calvinc
    Posted 8 years ago #

    i'm trying to get a link to the archives based on a specific post day. for some reason using the get_day_link function with the_time does not work and gives strange results.

    <?php echo get_day_link('2007','05','22'); ?><br/>
    the above works perfectly, as it should with the dates hard-coded.

    <?php echo the_time('Y'); ?>
    <?php echo the_time('m'); ?>
    <?php echo the_time('j'); ?><br/>
    the above 3 return the correct date of the post. 2007 05 22

    <?php echo get_day_link(the_time('Y'),the_time('m'),the_time('j')); ?><br/>
    the above however refuses to work and returns a link for the current date.

    what am i doing wrong?

  2. Try this:
    <?php echo get_day_link((int)the_time('Y'),(int)the_time('m'),(int)the_time('j')); ?>

  3. calvinc
    Posted 8 years ago #

    anybody else that wants to do this you have to use:
    <?php echo get_day_link(get_post_time('Y'), get_post_time('m'), get_post_time('j')); ?>

    NOTHING else will work!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.