0

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 *

3
  • 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? Commented Jan 23, 2013 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
    Commented Jan 23, 2013 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? Commented Jan 23, 2013 at 11:01

2 Answers 2

0

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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