Advertisement
Guest User

inc/loops/search.php

a guest
May 7th, 2015
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. <?php
  2.  
  3. global $canvys;
  4.  
  5. if ( have_posts() ) :
  6.  
  7. echo '<div class="posts-wrapper style-search">';
  8.  
  9. while ( have_posts() ) : the_post();
  10.  
  11. // grap the post type
  12. $post_type_obj = get_post_type_object( get_post_type() );
  13. $post_type_name = $post_type_obj->labels->singular_name;
  14.  
  15. // Standard post-title
  16. $standard_title = '<h2 class="post-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>'; ?>
  17.  
  18. <article id="post-<?php echo get_the_ID(); ?>" <?php post_class('search-result'); ?>>
  19.  
  20. <?php if ( 'post' == get_post_type() ) {
  21. switch ( cv_get_post_format() ) {
  22.  
  23. case 'quote':
  24. echo '<h2 class="post-title"><a href="' . get_permalink() . '">' . get_the_content() . '</a></h2>';
  25. echo '<h4 class="quote-author">' . get_the_title() . '</h4>';
  26. break;
  27.  
  28. case 'aside':
  29. echo '<div class="post-content">' . get_the_content() . '</div>';
  30. break;
  31.  
  32. default:
  33. echo $standard_title;
  34. break;
  35. }
  36. }
  37.  
  38. else {
  39. echo $standard_title;
  40. } ?>
  41.  
  42. <p class="result-meta">
  43. <a class="permalink" href="<?php echo get_permalink(); ?>" title="<?php _e( 'Permalink', 'canvys' ); ?>">
  44. <?php echo $post_type_name; ?> &middot;
  45. <?php echo get_the_date(); ?>
  46. </a>
  47. </p>
  48.  
  49. </article>
  50.  
  51. <?php endwhile;
  52.  
  53. echo '</div>';
  54.  
  55. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement