Statistics: Posted by ronhen — November 15th, 2011, 3:01 am
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<?php
$restrict_after=30 * 86400; // days * seconds per day (30 days)
$post_age = date('U') - get_post_time('U');
if ($post_age < $restrict_after || is_user_logged_in()) { ?>
<div class="entry">
<?php the_content(); ?>
</div>
<?php }
else { ?>
<div class="entry">
<p>This post is older than 30 days and can only be accessed with a <a href="http://example.com/join /">membership</a>. If you already have a membership, please <a href="http://example.com/login/">login</a> to view this post.</p>
</div>
<?php } // Closes if-block that checks post age ?>
</div> <!-- closes 'post class' -->
<?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
</div> <!-- closes 'content' -->
Statistics: Posted by Raam Dev — November 14th, 2011, 10:37 pm
Statistics: Posted by Eduan — November 14th, 2011, 10:41 am
Statistics: Posted by ronhen — November 14th, 2011, 10:11 am