WordPress.org

Ready to get started?Download WordPress

Forums

get_day_link from a theme's index.php page not working for me (4 posts)

  1. electricbob
    Member
    Posted 6 years ago #

    I'm trying to use get_day_link (and the month variety) to create a link on a main page of a theme - here's the code snippet:

    "><small class="day"><?php the_time('j') ?></small>

    I always get a URL like:

    http://www.alephnaught.com/Blog/20080531

    where I should get (base on the calendar widget):

    http://www.alephnaught.com/Blog/?m=20080531

    There's something different about calling this code from a <?php ?> tag set - can someone clue me in and help me solve this?

    Thanks and have fun! - Bob

  2. whooami
    Member
    Posted 6 years ago #

    "><small class="day"><?php the_time('j') ?></small>

    <?php the_time('j') ?> : all thats ever going to return in the date, and I believe thats the julian date (without doublechecking) -- and its working, or your numbers wouldnt be the same.

    Its the stuff before that that you didnt post here that is your problem

    --

    or wait, I understand.. you linking to JUST that, and consequently, its being tacked onto your url.. yah thats not the way you want to do,

    You can fix that by just hardcoding the http://... before you call the date variable. (thats the quickest thing I can come up with)

  3. electricbob
    Member
    Posted 6 years ago #

    More info...

    When I modify the code to something like:

    <?php $url = get_day_link(...); ?>
    <href a="<?php echo $url; ?>

    I get:

    20080531
    http://www.alephnaght.com/Blog/

    Which I don't get at all.

    The calendar widget just calle get_day_url() and returns a URL of the form:

    http://www.alephnaught.com/Blog/?m=20080531

    That ?m= is missing in all my returns - what's up?

    Thanks! - Bob

  4. electricbob
    Member
    Posted 6 years ago #

    I see your confusion - the part I'm having trouble with got clipped from my initial post:

    <a href="<?php get_day_link((int)the_time('Y'), (int)the_time('m'), (int)the_time('j')); ?>">

    The problem is with the get_day_link call.

    Thanks and have fun! - Bob

Topic Closed

This topic has been closed to new replies.

About this Topic