rhandom

Footer Related Posts .com and .nl

Jan 13th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.71 KB | None | 0 0
  1. <div class="related_posts span6"><span><?php _e('Related Posts',TEXT_DOMAIN); ?></span> <div class="clear"></div> <?php
  2.             $categories = get_the_category();
  3.  
  4.             if(!empty($categories)) {
  5.  
  6.                 $category = $categories[0];
  7.                 $vposts = get_posts(array('category'=>$category->ID,'posts_per_page'=>4));//TODO
  8.             } else {
  9.                 $vposts = get_posts(array('posts_per_page'=>4));
  10.             }
  11.                 foreach($vposts as $vpost) {                
  12.                     ?>
  13.                       <div class="span5">  
  14.                          <div class="avatar_small">
  15.                          <a href="<?php echo get_permalink($vpost);?>">
  16.                          <?php
  17.                          if(has_post_thumbnail($vpost->ID)) {
  18.                             echo get_the_post_thumbnail( $vpost->ID, array(70,70) );
  19.                          } else {
  20.                             echo get_avatar($authorData->ID,70);
  21.                          }
  22.                          ?>
  23.                          </a>
  24.                          </div>
  25.                          <div class="small_blok">
  26.                             <div class="categories"><a href="<?php echo get_permalink($vpost);?>"><?php  echo $vpost->post_title; ?></a></div>
  27.                             <div class="date_post"><?php echo date(' jS \ F Y', time());?></div>
  28.                             <a href="<?php echo get_permalink($vpost);?>"><div class="read_more"></div></a>
  29.                             <div class="clear"></div>
  30.                          </div>
  31.                      </div>
  32.                         <?php
  33.                 }
  34.  
  35.        ?></div>
  36.              <div class="clear"></div>
Advertisement
Add Comment
Please, Sign In to add comment