Title: date conditional (help!?)
Last modified: August 18, 2016

---

# date conditional (help!?)

 *  Resolved [sodypop](https://wordpress.org/support/users/sodypop/)
 * (@sodypop)
 * [20 years, 2 months ago](https://wordpress.org/support/topic/date-conditional-help/)
 * i am stumped. :-/
    i am trying to add a conditional for my posts stating basically
   the following:
 * if this post was entered more than 2 weeks ago then do nothing.
 * if it is newer than 2 weeks ago then echo “new”.
 * i for the life of me cannot figure it out.
    surely someone can help me with this
   one? i am sure it’s basic php.
 * here is the code that it will reside in:
 * <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class=”
   thumb”> “><?php the_excerpt(); ?> <span class=”thumbClient”><?php the_title();?
   ></span> <div class=”newPost”>
 * //new post conditional here
 * </div>
    </div> <?php endwhile; endif; ?>

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [20 years, 2 months ago](https://wordpress.org/support/topic/date-conditional-help/#post-369383)
 * [http://wordpress.org/support/topic/67239#post-355805](http://wordpress.org/support/topic/67239#post-355805)
 * Change the “conditional” if statement to:
 * `if($days_since <= 14) :`
 *  Thread Starter [sodypop](https://wordpress.org/support/users/sodypop/)
 * (@sodypop)
 * [20 years, 2 months ago](https://wordpress.org/support/topic/date-conditional-help/#post-369386)
 * so what would the whole code chunk look like? (i’m not a programmer)
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [20 years, 2 months ago](https://wordpress.org/support/topic/date-conditional-help/#post-369390)
 * It’s at the end of the link. But… This would go where your “//new post conditional
   here” is:
 * `<?php
    $days_since = floor((date('U') - get_the_time('U')) / 86400); if($days_since
   <= 14) : ?> ~ This displays if post 14 days or newer ~ <?php endif; ?>
 *  Thread Starter [sodypop](https://wordpress.org/support/users/sodypop/)
 * (@sodypop)
 * [20 years, 2 months ago](https://wordpress.org/support/topic/date-conditional-help/#post-369393)
 * works like a charm! – THANK YOU!!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘date conditional (help!?)’ is closed to new replies.

## Tags

 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [date](https://wordpress.org/support/topic-tag/date/)
 * [else](https://wordpress.org/support/topic-tag/else/)
 * [if](https://wordpress.org/support/topic-tag/if/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [sodypop](https://wordpress.org/support/users/sodypop/)
 * Last activity: [20 years, 2 months ago](https://wordpress.org/support/topic/date-conditional-help/#post-369393)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
