Hi, McGee, if you mean that you want to show, say, one “Monday” post every Monday, that pretty easy with custom post meta and date() function, that can return current weekday. date('l')
returns Sunday, date('D')
returns Sun, for your taste.
http://codex.wordpress.org/Formatting_Date_and_Time
E.g. if you add post meta with key ‘weekday’ and value ‘Sunday’, then you can query where do you want post with this meta.
$currentday = date('l');
$query = new WP_Query( array( 'meta_key' => 'weekday', 'meta_value' => $currentday ) );
http://codex.wordpress.org/Class_Reference/WP_Query
Thread Starter
McGee
(@maniche)
Hi vjpo,
“Hi, McGee, if you mean that you want to show, say, one “Monday” post every Monday, “
Thats excatly what i want..monday post every monday, repeatedly..
been working whole day, im burned atm so i did not fully understood your post..
as i understood, 1 is for sunday, 2 for monday etc etc..
can you provide me with custom query that has all 7 days in week asociated with specific post name..?
thanks for your feedback!
date('l')
there is lowercase L, not 1. This function automatically returns day of week. As Sunday, Monday etc.
So you can assign specific custom fields to posts those you want to rotate.
Like on this image “Name” can be “weekday” (same for all 7 posts) and value “Thursday” etc.
Read more about custom fields http://codex.wordpress.org/Custom_Fields
Then you can automatically query posts with current day name custom field. I can’t provide more detailed code, because you didn’t mention the details.