Grow your CSS skills. Land your dream job.

Display Date as week

  • # February 23, 2011 at 1:57 pm

    I need to display week range (from Thu to Wed) when WP post is published. So, for example, is I publish a post – date should be displayed as (Feb 23rd, 2011 – Mar 1st, 2011). Does anyone know this trick? Thanks….

    # February 24, 2011 at 8:40 pm

    I’m not super versed in WordPress, but I would set a variable as a string, then during ‘the loop’, check for the first iteration, append the first date. The check for the last iteration and append that date.

    Psudo code below


    //loop
    if($i == 0) {
    $date_range = date('m d, Y', post_date());
    }

    if($i == num_posts()) {
    $date .= '-'.date('m d, Y', post_date());
    }

    echo $date;

    You will have to either have 2 loops on the page since this is something you’d only post once on the page.

    Hope this is at least a direction.

    # February 25, 2011 at 10:24 am

    You should be able to modify the meta.php file easily enough to output the second date (see http://codex.wordpress.org/Post_Meta_Data_Section for details). Not sure how you’d actually input that second date, though — might need to use custom fields? Sorry I can’t be of more help, but hopefully this helps a bit.

    # February 26, 2011 at 2:06 pm

    hmmm. Interesting ideas. I thought about something like that:
    $first_date = the_time(‘d F Y’)
    $second_date = echo ($first_date+7)

    But that wouldn’t work because my podcast needs to be in Thursday-Wednesday range, is there any way to find out day of the week in PHP and do this calculation in this way?

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".