Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a code on my site that displays different headers for different post types using the if ( get_post_type() == 'post type here' ) { code

but is there a way i can do this for days of the week?

I want to create a calendar since i can't find an actual good calendar that works to my fits.

I want to create a list of shows and showtimes based on the day of the week and place it in the sidebar.

*I'm trying to create a list of items to display in the sidebar using a php code....for example when it's monday only the list for monday will show and etc......by using th echo '' term i want to be able to place <div> and or <tabel> inside the echo code *

share|improve this question
    
It's not really clear to me what it is you asking for. Are you trying to get different headers by the current day of the week, or by the day of the week the post/page is posted? –  Mike Madern Jan 23 '13 at 8:30
    
I'm not trying to get headers, I'm trying to create a list in the sidebar.....Monday (show this list of items)...Tuesday (Show this list of items) etc. –  Mihad Aiko Jan 23 '13 at 10:50
    
Could you provide us with a little more information? Its clear that you want a list of posts in your sidebar wich are ordered by day of the week. In your post, do you provide a date, a day of the week, or do you want to look at the postdate? Is this a post meta value or not? Do you want this list to show items only of the current week? –  Mike Madern Jan 23 '13 at 11:01
add comment

2 Answers

Most probably off-topic question...

You can use:

$var = date("D");

to get the current day of the week. Then make a switch or a series of if-else to choose which posts you'll want to display for that day.

share|improve this answer
add comment

Not sure understood your issue, but I believe you can use

$week = date("w", strtotime($eventdateandtime));

This should return numeric representation of the day of the week of your event (0 - for Sunday through 6 - for Saturday)

Hope that helps. Cheers.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.