Advertisement
Guest User

Untitled

a guest
Mar 11th, 2013
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. <?php
  2. /**
  3. * Single Post Template
  4. *
  5. * This template is the default page template. It is used to display content when someone is viewing a
  6. * singular view of a post ('post' post_type).
  7. * @link http://codex.wordpress.org/Post_Types#Post
  8. *
  9. * @package WooFramework
  10. * @subpackage Template
  11. */
  12.  
  13. get_header();
  14. ?>
  15.  
  16. <!-- #content Starts -->
  17. <?php woo_content_before(); ?>
  18. <div id="content" class="col-full">
  19.  
  20. <div id="main-sidebar-container">
  21.  
  22. <!-- #main Starts -->
  23. <?php woo_main_before(); ?>
  24. <div id="main">
  25. <?php
  26. woo_loop_before();
  27.  
  28. if (have_posts()) { $count = 0;
  29. while (have_posts()) { the_post(); $count++; ?>
  30. <div id="productpic"><?php the_post_thumbnail(); ?></div>
  31. <p class="summary"><?php woo_get_template_part( 'content', get_post_type() ); ?></p>
  32. <div id="ratingtitle"><p>AVERAGE STAR RATINGS</p></div>
  33. <?php function percentage($val1, $val2, $precision)
  34. {
  35. $division = $val1 / $val2;
  36.  
  37. $res = $division * 100;
  38.  
  39. $res = round($res, $precision);
  40.  
  41. return $res;
  42. } ?>
  43. <div id="score"><p>OVERALL SCORE</p><div id="percent"><?php echo percentage(get_post_meta($post->ID, 'averagerating_rc', true), 5, 0); ?>%</div></div>
  44. <div id="vendor">Vendor / Manufacturer: <?php echo get_post_meta($post->ID, 'Vendor', true); ?></div>
  45. <a id="urlquotebox" href="<?php echo get_post_meta($post->ID, 'vendorweb', true); ?>" target="blank">Vendor Product Page</a>
  46. <?php global $post;
  47. $current_post = $post->ID;
  48. $categories = get_the_category();
  49. foreach ($categories as $category) :
  50. ?>
  51. <div class="my-related-posts"><h4>You may also be interested in...</h4><ul class="relatedposts">
  52. <?php
  53. $duplicates = array( $current_post );
  54. $posts = get_posts( array( 'posts_per_page' => 4, 'orderby' => 'rand', 'category' => $category->term_id, 'post__not_in' => array( $current_post )) );
  55. $second_numbers = (!$posts) ? 4 : (4 - count( $posts ));
  56. if( $posts ) :
  57. foreach($posts as $post) :
  58. setup_postdata( $post );
  59. $duplicates[] = $post->ID;
  60. $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ));
  61. ?>
  62. <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?><br /><img src="<?php echo esc_url( $image[0] ); ?>" alt="View more info" /></a></li>
  63. <?php endforeach; wp_reset_postdata();
  64. endif;
  65.  
  66. if( $second_numbers >=1 ) :
  67. $posts = get_posts( array('posts_per_page' => $second_numbers, 'orderby' => 'rand', 'post__not_in' => $duplicates ) );
  68. if( $posts ) foreach($posts as $post) :
  69. setup_postdata( $post );
  70. $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ));
  71. ?>
  72. <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?><br /><img src="<?php echo esc_url( $image[0] ); ?>" alt="View more info" /></a></li>
  73. <?php endforeach; wp_reset_postdata();
  74. endif; ?>
  75.  
  76. </ul>
  77. </div>
  78. <?php
  79. }
  80. }
  81. woo_loop_after();
  82. ?> <h3 class="commentstitle">USER REVIEWS</h3>
  83. </div><!-- /#main -->
  84. <?php woo_main_after(); ?>
  85. <?php get_sidebar(); ?>
  86.  
  87. </div><!-- /#main-sidebar-container -->
  88.  
  89. <?php get_sidebar('alt'); ?>
  90.  
  91. </div><!-- /#content -->
  92. <?php woo_content_after(); ?>
  93.  
  94. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement