Tahir-Support

Search.php without sidebar

Mar 21st, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 KB | None | 0 0
  1. <?php get_header(); ?>
  2.  
  3. <script>
  4. jQuery(document).ready(function($){
  5.  
  6. var $searchContainer = $('#search-results');
  7.  
  8. $(window).load(function(){
  9.  
  10. $searchContainer.isotope({
  11. itemSelector: '.result',
  12. layoutMode: 'packery',
  13. packery: { columnWidth: $('#search-results').width() / 3 }
  14. });
  15.  
  16. $searchContainer.css('visibility','visible');
  17.  
  18. });
  19.  
  20. $(window).resize(function(){
  21. $searchContainer.isotope({
  22. layoutMode: 'packery',
  23. packery: { columnWidth: $('#search-results').width() / 3}
  24. });
  25. });
  26.  
  27.  
  28. });
  29. </script>
  30.  
  31. <div class="container-wrap">
  32.  
  33. <div class="container main-content">
  34.  
  35. <div class="row">
  36. <div class="col span_12">
  37. <div class="col span_12 section-title">
  38. <h1><?php echo __('Results For', NECTAR_THEME_NAME); ?><span>"<?php echo esc_html( get_search_query( false ) ); ?>"</span></h1>
  39. </div>
  40. </div>
  41. </div>
  42.  
  43. <div class="divider"></div>
  44.  
  45. <div class="row">
  46.  
  47. <div class="col span_12">
  48.  
  49. <div id="search-results">
  50.  
  51. <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
  52.  
  53.  
  54.  
  55. <?php if( get_post_type($post->ID) == 'post' ){ ?>
  56. <article class="result">
  57. <div class="inner-wrap">
  58. <span class="bottom-line"></span>
  59. <?php if(has_post_thumbnail( $post->ID )) {
  60. echo '<a href="'.get_permalink().'">'.get_the_post_thumbnail($post->ID, 'full', array('title' => '')).'</a>';
  61. } ?>
  62. <h2 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <span><?php echo __('Blog Post', NECTAR_THEME_NAME); ?></span></h2>
  63. </div>
  64. </article><!--/search-result-->
  65. <?php }
  66.  
  67. else if( get_post_type($post->ID) == 'page' ){ ?>
  68. <article class="result">
  69. <div class="inner-wrap">
  70. <span class="bottom-line"></span>
  71. <h2 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <span><?php echo __('Page', NECTAR_THEME_NAME); ?></span></h2>
  72.  
  73. <?php if(has_excerpt()) the_excerpt(); ?>
  74. </div>
  75. </article><!--/search-result-->
  76. <?php }
  77.  
  78. else if( get_post_type($post->ID) == 'portfolio' ){ ?>
  79. <article class="result">
  80. <div class="inner-wrap">
  81. <span class="bottom-line"></span>
  82. <?php if(has_post_thumbnail( $post->ID )) {
  83. echo '<a href="'.get_permalink().'">'.get_the_post_thumbnail($post->ID, 'full', array('title' => '')).'</a>';
  84. } ?>
  85. <h2 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <span><?php echo __('Portfolio Item', NECTAR_THEME_NAME); ?></span></h2>
  86. </div>
  87. </article><!--/search-result-->
  88. <?php }
  89.  
  90. else if( get_post_type($post->ID) == 'product' ){ ?>
  91. <article class="result">
  92. <div class="inner-wrap">
  93. <span class="bottom-line"></span>
  94. <?php if(has_post_thumbnail( $post->ID )) {
  95. echo '<a href="'.get_permalink().'">'. get_the_post_thumbnail($post->ID, 'full', array('title' => '')).'</a>';
  96. } ?>
  97. <h2 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <span><?php echo __('Product', NECTAR_THEME_NAME); ?></span></h2>
  98. </div>
  99. </article><!--/search-result-->
  100. <?php } else { ?>
  101. <article class="result">
  102. <div class="inner-wrap">
  103. <span class="bottom-line"></span>
  104. <?php if(has_post_thumbnail( $post->ID )) {
  105. echo '<a href="'.get_permalink().'">'.get_the_post_thumbnail($post->ID, 'full', array('title' => '')).'</a>';
  106. } ?>
  107. <h2 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
  108. </div>
  109. </article><!--/search-result-->
  110. <?php } ?>
  111.  
  112.  
  113.  
  114. <?php endwhile;
  115.  
  116. else: echo "<p>" . __('No results found', NECTAR_THEME_NAME) . "</p>"; endif;?>
  117.  
  118.  
  119. </div><!--/search-results-->
  120.  
  121.  
  122. <?php if( get_next_posts_link() || get_previous_posts_link() ) { ?>
  123. <div id="pagination">
  124. <div class="prev"><?php previous_posts_link('&laquo; Previous Entries') ?></div>
  125. <div class="next"><?php next_posts_link('Next Entries &raquo;','') ?></div>
  126. </div>
  127. <?php }?>
  128.  
  129. </div><!--/span_9-->
  130. <!--
  131. <div id="sidebar" class="col span_3 col_last">
  132. <?php get_sidebar(); ?>
  133. </div>/span_3-->
  134.  
  135. </div><!--/row-->
  136.  
  137. </div><!--/container-->
  138.  
  139. </div><!--/container-wrap-->
  140.  
  141. <?php get_footer(); ?>
Add Comment
Please, Sign In to add comment