Advertisement
Guest User

review page

a guest
Aug 18th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.98 KB | None | 0 0
  1. <?php get_header(); ?>
  2.  
  3.  
  4. <?php get_template_part( "beforeloop", "single" ) ?>
  5.  
  6. <?php if (have_posts()) : ?>
  7. <?php while (have_posts()) : the_post(); ?>
  8.  
  9. <?php if ( post_password_required() ) : ?>
  10. <div class="password_p">
  11. <?php the_content(); ?>
  12. </div><!-- /password_p -->
  13.  
  14. <?php else : ?>
  15.  
  16. <article id="post-<?php the_ID(); ?>" class="post">
  17. <h1 class="post_title"><?php the_title(); ?></h1>
  18. <?php $count = 0;
  19. $rate_sum=0.0;
  20. $avg_rating = simple_fields_values("review_rating");
  21. foreach($avg_rating as $rating)
  22. {
  23. $rate_sum += $rating;
  24. $count++;
  25. }
  26. $avg_rate = (int)($rate_sum/$count * 10);
  27. $draw = "rating-static rating-".$avg_rate;
  28. echo "<span class='".$draw."'></span>";
  29. ?>
  30.  
  31. <?php
  32. $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
  33. if($thumbnail){
  34. ?>
  35. <div style="float:left;width:30%;height:250px;">
  36. <?php echo get_the_post_thumbnail($id, 'thumbnail'); ?>
  37.  
  38. <!-- <img src="<?php echo get_template_directory_uri(); ?>/framework/timthumb.php?src=<?php echo $thumbnail[0]; ?>&amp;h=230&amp;w=590" alt="<?php the_title(); ?>" /> -->
  39.  
  40.  
  41. </div><!-- /img_post -->
  42.  
  43. <?php
  44. }
  45. ?>
  46.  
  47. <?php /* include (TEMPLATEPATH . '/framework/meta.php' ); */ ?>
  48.  
  49. <div id="review-article" style="float:right;width:67%;"> <?php the_content('Read more'); ?> </div>
  50.  
  51.  
  52. <div class="clear"></div>
  53.  
  54.  
  55. <div id="review-tags" style="float:right;width:67%;">
  56. <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
  57. <?php the_tags('<ul class="fancy_tags"><li>','</li><li>','</li></ul>'); ?>
  58.  
  59. <div class="clear"></div></div>
  60.  
  61. <div id="review">
  62. <?php /*$selected_value = simple_fields_get_post_value(get_the_id(), "Add Image", true);
  63. if($selected_value[is_image]){
  64. echo $selected_value[link][thumbnail];
  65. } */
  66.  
  67. $descriptions =simple_fields_values("description_wine");
  68. $images =simple_fields_values("image_wine");
  69. $authors =simple_fields_values("author_review");
  70. //print_r($images);
  71. $count=1;
  72. foreach($descriptions as $description)
  73. {
  74. ?>
  75.  
  76. <div class='clear'></div>
  77. <div class='clear'></div>
  78.  
  79. <div style="display:block;clear:both;">
  80.  
  81. <div id="review-header"><?php echo $authors[$count-1]; ?></div>
  82. <?php $rate = (int)($avg_rating[$count-1]*10); $draw = "rating-static rating-".$rate; ?>
  83.  
  84. <div style="float:left;width:30%;clear:right;"><?php echo "<span class='".$draw."'></span>"; ?></div>
  85. <div id="individual-review">
  86. <?php if($images [$count-1][link][thumbnail]!="Missing Attachment")
  87. {
  88. echo $images[$count-1][link][thumbnail];
  89. } ?>
  90. </div>
  91.  
  92.  
  93. <div style="float:right;width:67%;">
  94. <?php $count += 1;
  95. echo $description; ?>
  96. </div>
  97. </div>
  98.  
  99. <div class='clear'></div>
  100.  
  101. <?php }
  102.  
  103. ?>
  104.  
  105. </div>
  106.  
  107. <p><?php edit_post_link('Edit entry','',''); ?></p>
  108. </article>
  109.  
  110. <div class="clear"></div>
  111.  
  112. <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('post-widgets')) : else : ?>
  113. <?php endif; ?>
  114.  
  115. <?php comments_template(); ?>
  116.  
  117.  
  118.  
  119. <?php endif; //password ?>
  120.  
  121. <?php endwhile; else: ?>
  122.  
  123. <article>
  124. <p>Sorry, no posts matched your criteria.</p>
  125. </article>
  126.  
  127. <?php endif; ?>
  128.  
  129. <?php get_template_part( "afterloop", "single" ) ?>
  130.  
  131. <?php get_footer(); ?>
  132.  
  133.  
  134. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement