Advertisement
Guest User

sjeremy

a guest
Sep 6th, 2012
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.70 KB | None | 0 0
  1. <?php
  2. $s = $_POST['s'];
  3. query_posts('s='.$s.'');
  4. if (have_posts()) : while (have_posts()) : the_post();
  5. ?>
  6.         <div class="box">
  7.             <div class="box-holder">
  8.                 <div class="box-frame">
  9.                     <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  10.                         <h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
  11.                         <em class="meta"><?php ehrscope_posted_on(); ?>&nbsp;|&nbsp;<span class="total-comments"><?php comments_popup_link(); ?></span></em>
  12.                         <?php
  13.                         if (!is_single() && has_excerpt()):
  14.                             the_excerpt();
  15.                         else:
  16.                             the_content(__('Continue reading', 'ehrscope') . ': <em>' . the_title('', '', false) . '</em>');
  17.                         endif;
  18.                         ?>
  19.                         <div class="clear"></div>
  20.                         <?php
  21.                         if (is_single()):
  22.                             ehrscope_wp_link_pages();
  23.                             $tags = wp_get_post_tags($post->ID);
  24.                             ?>
  25.                             <p class="entry-meta"><?php ehrscope_show_tags(); ?></p>
  26.                             <?php if ($tags): ?>
  27.                                 <a href="javascript:void(0);" id="toggle-related-posts" class="button"><?php _e('Show Related Posts', 'ehrscope'); ?></a>
  28.                                 <?php
  29.                             endif;
  30.                         endif;
  31.                         ?>
  32.                     </div>
  33.                 </div>
  34.             </div>
  35.         </div>
  36.  
  37.         <?php if (is_single()): ?>
  38.             <div class="box" id="related-posts-cage">
  39.                 <div class="box-holder">
  40.                     <div class="box-frame">
  41.                         <div>
  42.                             <?php if (is_single()): ?>
  43.                                 <?php
  44.                                 if ($tags):
  45.                                     $tag_ids = array();
  46.                                     foreach ($tags as $individual_tag) {
  47.                                         $tag_ids[] = $individual_tag->term_id;
  48.                                     }
  49.                                     $args = array(
  50.                                         'tag__in' => $tag_ids,
  51.                                         'post__not_in' => array($post->ID),
  52.                                         'posts_per_page' => 10, // Number of related posts to display.
  53.                                         'caller_get_posts' => 1
  54.                                     );
  55.                                     $my_query = new WP_Query($args);
  56.                                     if ($my_query->have_posts()):
  57.                                         ?>
  58.                                         <h3><?php _e('Related Posts', 'ehrscope'); ?></h3>
  59.                                         <ul>
  60.                                             <?php
  61.                                             while ($my_query->have_posts()) : $my_query->the_post();
  62.                                                 ?>
  63.                                                 <li>
  64.                                                     <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
  65.                                                     &nbsp;
  66.                             <!--                                                <span class="related-posts-date"><?php the_time('F jS, Y'); ?></span>-->
  67.                                                 </li>
  68.                                                     <?php
  69.                                             endwhile;
  70.                                             ?>
  71.                                         </ul>
  72.                                         <?php
  73.                                     endif;
  74.                                 endif;
  75.                             endif;
  76.                             ?>
  77.                         </div>
  78.                     </div>
  79.                 </div>
  80.             </div>
  81.             <?php
  82.         endif;
  83.         comments_template('', true);
  84.     endwhile;
  85. else:
  86.     ?>
  87.     <div class="box">
  88.         <div class="box-holder">
  89.             <div class="box-frame">
  90.                 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  91.                     <h2><?php _e('No Results', 'ehrscope'); ?></h2>
  92.                     <p><?php _e('Sorry, no posts matched your criteria.', 'ehrscope'); ?></p>
  93.                 </div>
  94.             </div>
  95.         </div>
  96.     </div>
  97. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement