Advertisement
Guest User

post.php

a guest
Oct 7th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. <?php get_header(); ?>
  2.  
  3. <?php if (get_post_type() != 'portfolio' && get_post_type() != 'gallery'){ ?>
  4.  
  5. <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
  6.  
  7. <?php setPostViews(get_the_ID()); ?>
  8.  
  9. <div class="post-container">
  10.  
  11. <div id="post-<?php the_ID();?>" <?php post_class('post'); ?>>
  12.  
  13. <div class="post-info">
  14.  
  15. <div class="date">
  16. <div class="day"><?php the_time('j'); ?></div>
  17. <div class="month"><?php the_time('M'); ?></div>
  18. </div>
  19.  
  20. <div class="title-meta">
  21. <h1 class="post-title"><?php the_title(); ?></h1>
  22. <div class="meta"><?php _e('Posted on', 'ikaros'); ?> <?php the_time('F j, Y'); ?> by <a href="<?php echo get_author_posts_url(get_the_author_meta( 'ID' )); ?>"><?php the_author(); ?></a> in <?php the_category(', '); ?> with <?php comments_number(__('No Comments', 'ikaros')); ?></div>
  23. </div>
  24.  
  25. </div>
  26.  
  27. <?php the_content(); ?>
  28.  
  29. <?php if(has_tag()) : ?><div class="tags"><span></span> <?php the_tags('Tags: ', ', '); ?></div><?php endif; ?>
  30.  
  31. </div>
  32.  
  33. <div class="related">
  34.  
  35. <h3><?php _e('Related Posts', 'ikaros'); ?></h3>
  36. <ul>
  37.  
  38. <?php
  39.  
  40. $pops_k = 0;
  41. $tags = array();
  42.  
  43. $post_terms = wp_get_object_terms($post->ID, 'post_tag');
  44. $tag = isset($post_terms[0] -> name) ? $post_terms[0] -> name : '';
  45. if(!empty($post_terms)){
  46. if(!is_wp_error( $post_terms ))
  47. foreach($post_terms as $term)
  48. array_push($tags, $term->name);
  49. }
  50.  
  51. endwhile;
  52.  
  53. $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
  54. $args = array( 'posts_per_page' => 4,
  55. 'offset'=> 0,
  56. 'tag' => implode($tags, ','));
  57.  
  58. $all_posts = new WP_Query($args);
  59. while($all_posts->have_posts()) : $all_posts->the_post();
  60. $pops_k++;
  61. ?>
  62.  
  63. <li><div class="featured"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a></div></li>
  64.  
  65. <?php endwhile; ?>
  66.  
  67. </ul>
  68.  
  69. <?php echo '<p class="hidden">' . $pops_k . '</p>'; ?>
  70.  
  71. </div>
  72.  
  73. <?php if ( have_posts() ) while ( have_posts() ) : the_post();
  74. comments_template( '', true );
  75. endwhile; ?>
  76.  
  77. </div>
  78.  
  79. <div class="sidebar">
  80. <?php if(is_active_sidebar('rb_blog_widget'))
  81. dynamic_sidebar('rb_blog_widget'); ?>
  82. </div>
  83.  
  84. <?php } else if(get_post_type() == 'portfolio') {
  85. include('single-project.php');
  86. } else if(get_post_type() == 'gallery') {
  87. include('single-gallery.php');
  88. }
  89.  
  90. ?>
  91.  
  92. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement