php - Display a custom Wordpress taxonomy tag automatically based on the day of the week? -


i've got client wants display custom taxonomy tags automatically day of week in wordpress. basically, we'll have custom post type called "products" , have taxonomy called "day." within "day" we'll have 7 tags, 1 each day of week, , tagged specific day of week display on day on home page.

so, example, if product a, b & c assigned tag of "wednesday" within taxonomy "day" , today wednesday, items display on home page. if products d, e & f assigned thursday, they'll show on thursday, , on.

with said, part need writing loop can detect day of week , query proper taxonomy tag. have idea how go this? can't find reference on , php skills rudimentary @ best. :-/

here's loop i'm using display products manually custom post type, taxonomy & term:

<?php query_posts('post_type=products&taxonomy=day&term=wednesday&posts_per_page=10'); ?> <?php if(have_posts()) : while (have_posts() ) : the_post(); ?> <div class="archivecustompost"> <div class="archivecustomleftblock"> <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail( array(150,150) ); ?></a> </div> <div class="archivecustomrightblock"> <h2><?php the_title(); ?></h2> <?php the_excerpt(); ?> <p class="button"><a href="<?php the_permalink() ?>" rel="bookmark">learn more</a></p> </div> </div> <?php endwhile; endif; ?> 

you should try this,

using wp_query

$day = date("l"); // gives todays day. $wpq = array (post_type =>'product','taxonomy'=>'day','term'=>$day); $query = new wp_query ($wpq); 

using query_post:

$day = date("l"); $args = 'post_type=products&taxonomy=day&term='.$day.'&posts_per_page=10'; query_posts($args); 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -