php - Wordpress - Display a post a week in advance -


  • i have speakers category
  • each speaker set post
  • the wordpress published date, date coming speak (so speakers posts "scheduled")
  • there new speaker each week (every 7 days)
  • on speakers page display "featured speaker of week" contains post information
  • underneath featured speaker, list of upcoming speakers (just title, not whole post)

what i'm trying accomplish have "featured speaker", show week (including day speaking), , once day after have spoken comes, show next person speaking on site week until have spoken , on , forth.

i'm getting stumped on logic. doing until hit:

if($postdatenum >= $todaynum + 6)

which not work when it's different month.

i know code convoluted , outdated, if can shed light on logic calculating 7 days thing, awesome.

here's have far:

<?php      query_posts(array(          'post_type' => 'post',     'category_name' => 'speakers',     'showposts' => 1,     'order' => desc     ) );    while (have_posts()) : the_post(); ?> <div class=""> <?php  $today = date('m/d'); $postdate = the_date('m/d','','',false); //if post date , todays date not same if($postdate != $today){      wp_reset_query();     query_posts(array(          'post_status' => 'future',         'showposts' => 1,         'order' => asc         ) );       while (have_posts()) : the_post();      $todaynum = date('d'); //10     $postdatenum = the_date('d','','',false); //17      if($postdatenum >= $todaynum + 6){ ?>         <h2><?php the_title(); ?></h2>         <?php the_post_thumbnail(('medium'), array('class' => 'alignright')); ?>         <?php the_content(); ?>  <?php     }      endwhile;     wp_reset_query();  }else{ ?>     <h2><?php the_title(); ?></h2>     <?php the_post_thumbnail(('medium'), array('class' => 'alignright')); ?>     <?php the_content(); ?> <?php } endwhile; ?> 

use strtotime , date

if($postdatenum >= date('y-m-d', strtotime('today' . '+6 days') ) )   

not sure format using here diff formats http://php.net/manual/en/function.date.php. obviously cant use day because months , years involved.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -