• Resolved rleap

    (@rleap)


    So I am useing the following code to generate a list of daily archive links.

    <?php wp_get_archives('type=daily&limit=7'); ?>

    The above code generates this

    June 5, 2008
    June 4, 2008
    June 3, 2008
    June 2, 2008
    June 1, 2008
    etc..

    Is there a way to reformat the link text so that it reads…

    6/5
    6/4
    6/3
    6/2
    6/1

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try to change ‘Date Format’ (Settings->General) from F j, Y to n/j . You can use php’s date function for format reference : http://id.php.net/date

    Thread Starter rleap

    (@rleap)

    Here is what I ended up doing. Since I am not a php guru, this is probably not the most effecient code, however it works. You can see it in action on my home page. http://www.twoguysnamedrob.com

    <!-- Start date archive link list-->
    <?php
    $dt = mktime(0,0,0,date("m"),date("d")-1,date("Y"));
    ?>
    
    <a href="http://www.twoguysnamedrob.com/<?php echo date("Y/m/d", $dt); ?>/"><?php echo date("m/d", $dt); ?></a>
    
    &nbsp;|&nbsp;
    
    <?php
    $dt = mktime(0,0,0,date("m"),date("d")-2,date("Y"));
    ?>
    
    <a href="http://www.twoguysnamedrob.com/<?php echo date("Y/m/d", $dt); ?>/"><?php echo date("m/d", $dt); ?></a>
    
    &nbsp;|&nbsp;
    
    <?php
    $dt = mktime(0,0,0,date("m"),date("d")-3,date("Y"));
    ?>
    
    <a href="http://www.twoguysnamedrob.com/<?php echo date("Y/m/d", $dt); ?>/"><?php echo date("m/d", $dt); ?></a>
    
    &nbsp;|&nbsp;
    
    <?php
    $dt = mktime(0,0,0,date("m"),date("d")-4,date("Y"));
    ?>
    
    <a href="http://www.twoguysnamedrob.com/<?php echo date("Y/m/d", $dt); ?>/"><?php echo date("m/d", $dt); ?></a>
    
    &nbsp;|&nbsp;
    
    <?php
    $dt = mktime(0,0,0,date("m"),date("d")-5,date("Y"));
    ?>
    
    <a href="http://www.twoguysnamedrob.com/<?php echo date("Y/m/d", $dt); ?>/"><?php echo date("m/d", $dt); ?></a>
    
    &nbsp;|&nbsp;
    
    <?php
    $dt = mktime(0,0,0,date("m"),date("d")-6,date("Y"));
    ?>
    
    <a href="http://www.twoguysnamedrob.com/<?php echo date("Y/m/d", $dt); ?>/"><?php echo date("m/d", $dt); ?></a>
    
    &nbsp;|&nbsp;
    
    <?php
    $dt = mktime(0,0,0,date("m"),date("d")-7,date("Y"));
    ?>
    
    <a href="http://www.twoguysnamedrob.com/<?php echo date("Y/m/d", $dt); ?>/"><?php echo date("m/d", $dt); ?></a>
    
    <!-- End link list-->
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘wp_get_archives’ is closed to new replies.