Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $count = 0;
- $result = '';
- $catposts = get_posts('cat=8&&numberposts=0');
- if ( $catposts ) { //if there are any posts ?>
- <div id="whatshot">
- <?php foreach($catposts as $single):
- setup_postdata($single);
- $mylimit=1 * 7200; //days * seconds per day
- $post_age = date('U') - mysql2date('U', $single->post_date_gmt);
- if ($post_age < $mylimit) {
- $count++;
- if ( $count < 4 ) { // only process 3
- $result .= '<a href=';
- $result .=get_permalink($single->ID).'>'.$single->post_title.'</a>';
- }
- }
- endforeach;
- if ($result ==''){}
- else{
- echo "<h2><a href='/category/hot/'>The Latest</a></h2><ul>";
- echo $result."</ul>";
- } ?>
- </div>
- <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement