- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
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….
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.
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.
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?