Advertisement
Guest User

search.php

a guest
Feb 24th, 2015
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.98 KB | None | 0 0
  1. <?php get_header(); ?>
  2.     <?php
  3.     $sidebar_exists = true;
  4.     $container_class = '';
  5.     $timeline_icon_class = ''; 
  6.     $post_class = '';
  7.     $content_class = '';
  8.     $sidebar_exists = false;
  9.     $sidebar_left = '';
  10.     $double_sidebars = false;
  11.  
  12.     $sidebar_1 = $smof_data['search_sidebar'];
  13.     $sidebar_2 = $smof_data['search_sidebar_2'];
  14.     if( $sidebar_1 != 'None' && $sidebar_2 != 'None' ) {
  15.         $double_sidebars = true;
  16.     }
  17.  
  18.     if( $sidebar_1 != 'None' ) {
  19.         $sidebar_exists = true;
  20.     } else {
  21.         $sidebar_exists = false;
  22.     }
  23.  
  24.     if( ! $sidebar_exists ) {
  25.         $content_css = 'width:100%';
  26.         $sidebar_css = 'display:none';
  27.         $content_class= 'full-width';
  28.         $sidebar_exists = false;
  29.     } elseif($smof_data['search_sidebar_position'] == 'Left') {
  30.         $content_css = 'float:right;';
  31.         $sidebar_css = 'float:left;';
  32.         $sidebar_left = 1;
  33.     } elseif($smof_data['search_sidebar_position'] == 'Right') {
  34.         $content_css = 'float:left;';
  35.         $sidebar_css = 'float:right;';
  36.         $sidebar_left = 2;
  37.     }
  38.  
  39.     if($double_sidebars == true) {
  40.         $content_css = 'float:left;';
  41.         $sidebar_css = 'float:left;';
  42.         $sidebar_2_css = 'float:left;';
  43.     } else {
  44.         $sidebar_left = 1;
  45.     }
  46.  
  47.     if($smof_data['search_layout'] == 'Large Alternate') {
  48.         $post_class = 'large-alternate';
  49.     } elseif($smof_data['search_layout'] == 'Medium Alternate') {
  50.         $post_class = 'medium-alternate';
  51.     } elseif($smof_data['search_layout'] == 'Medium') {
  52.         $post_class = 'medium';        
  53.     } elseif($smof_data['search_layout'] == 'Grid') {
  54.         $post_class = 'grid-post';
  55.         $container_class = sprintf( 'grid-layout grid-layout-%s isotope', $smof_data['blog_grid_columns'] );
  56.     } elseif($smof_data['search_layout'] == 'Timeline') {
  57.         $post_class = 'timeline-post';
  58.         $container_class = 'timeline-layout isotope';
  59.         if($smof_data['search_sidebar'] != 'None') {
  60.             $container_class = 'timeline-layout timeline-sidebar-layout isotope';
  61.             $timeline_icon_class = ' has-sidebar';         
  62.         }
  63.     }
  64.     ?>
  65.     <div id="content" class="<?php echo $content_class; ?>" style="<?php echo $content_css; ?>">
  66.         <?php
  67.         if($smof_data['search_results_per_page']) {
  68.             $page_num = $paged;
  69.             if ($pagenum='') { $pagenum = 1; }
  70.                 global $query_string;
  71.             // removed post_query for search plugin
  72.         } ?>
  73.  
  74.         <?php if ( have_posts() && strlen( trim(get_search_query()) ) != 0 ) : ?>
  75.         <div class="search-page-search-form">
  76.             <h2><?php echo __('Need a new search?', 'Avada'); ?></h2>
  77.             <p><?php echo __('If you didn\'t find what you were looking for, try a new search!', 'Avada'); ?></p>
  78.             <form id="searchform" class="seach-form" role="search" method="get" action="<?php echo home_url( '/' ); ?>">
  79.                 <div class="search-table">
  80.                     <div class="search-field">
  81.                         <input type="text" value="" name="s" id="s" placeholder="<?php _e( 'Search ...', 'Avada' ); ?>"/>
  82.                     </div>
  83.                     <div class="search-button">
  84.                         <input type="submit" id="searchsubmit" value="&#xf002;" />
  85.                     </div>
  86.                 </div>
  87.             </form>    
  88.         </div>     
  89.         <?php if($smof_data['search_layout'] == 'Timeline'): ?>
  90.         <div class="timeline-icon<?php echo $timeline_icon_class; ?>"><i class="fusionicon-bubbles"></i></div>
  91.             <?php endif; ?>
  92.             <div id="posts-container" style="display: inline-block; "class="<?php echo $container_class; ?> clearfix">
  93.                 <?php
  94.                 $post_count = 1;
  95.  
  96.                 $prev_post_timestamp = null;
  97.                 $prev_post_month = null;
  98.                 $prev_post_year = null;
  99.                 $first_timeline_loop = false;
  100.  
  101.                 while(have_posts()): the_post();
  102.                     $post_timestamp = strtotime($post->post_date);
  103.                     $post_month = date('n', $post_timestamp);
  104.                     $post_year = get_the_date('o');
  105.                     $current_date = get_the_date('o-n');
  106.                 ?>
  107.                
  108.                
  109.                
  110.                 <?php if($smof_data['search_layout'] == 'Timeline'): ?>
  111.                 <?php if($prev_post_month != $post_month || $prev_post_year != $post_year): ?>
  112.                     <div class="timeline-date"><h3 class="timeline-title"><?php echo get_the_date($smof_data['timeline_date_format']); ?></h3></div>
  113.                 <?php endif; ?>
  114.                 <?php endif; ?>
  115.                 <?php $thumb_class = ''; ?>
  116.                 <?php if(get_post_meta(get_the_ID(), 'pyre_video', true) ): ?>
  117.                 <?php $thumb_class = ' has-post-thumbnail'; ?>
  118.                 <?php endif; ?>
  119.                 <div id="post-<?php the_ID(); ?>" style="display: inline-block;" >             
  120.                    
  121.                     <div class="post-content-container">
  122.                                                 <div class="post-content">
  123.                             <?php if($smof_data['search_layout'] == 'Large Alternate' || $smof_data['search_layout'] == 'Medium Alternate'  || $smof_data['search_layout'] == 'Grid' || $smof_data['search_layout'] == 'Timeline'): ?>
  124.                             <a  class="figurelink" href="<?php the_permalink(); ?>"><figure class="figsmall">
  125.                                                        
  126.                                     <img src=" <?php the_field('thumb') ?> " width="207" height="141" alt="0" data-width-desktop="920" data-height-desktop="215" data-cssclass-desktop="desktop" data-width-mobile-high-res="920" data-height-mobile-high-res="215" data-cssclass-mobile-high-res="mobile-high-res"  data-width-mobile-low-res="768" data-height-mobile-low-res="179" data-cssclass-mobile-low-res="mobile-low-res">
  127.                                                         <figcaption class="figsmall"><?php the_title(); ?></figcaption>        
  128.                                                     </figure></a>
  129.                            
  130.                            
  131.                            
  132.                             <?php endif; ?>
  133.                         </div>
  134.                                                
  135.                                             </div>
  136.                 </div>
  137.                 <?php
  138.                 $prev_post_timestamp = $post_timestamp;
  139.                 $prev_post_month = $post_month;
  140.                 $prev_post_year = $post_year;
  141.                 $post_count++;
  142.                 endwhile;
  143.                 ?>
  144.             </div>
  145.             <?php themefusion_pagination($pages = '', $range = 2); ?>
  146.         <?php wp_reset_query(); ?>
  147.     <?php else: ?>
  148.     <div class="post-content">
  149.         <div class="fusion-title title">
  150.             <h2 class="title-heading-left"><?php echo __('Couldn\'t find what you\'re looking for!', 'Avada'); ?></h2><div class="title-sep-container"><div class="title-sep sep-double"></div></div>          
  151.         </div>
  152.         <div class="error_page">
  153.             <div class="fusion-one-third one_third fusion-column">
  154.                 <h1 class="oops <?php echo ($sidebar_css != 'display:none') ? 'sidebar-oops' : ''; ?>"><?php echo __('Oops!', 'Avada'); ?></h1>
  155.             </div>
  156.             <div class="fusion-one-third one_third fusion-column useful_links">
  157.                 <h3><?php echo __('Here are some useful links:', 'Avada'); ?></h3>
  158.                 <?php $iconcolor = strtolower($smof_data['checklist_icons_color']); ?>
  159.  
  160.                 <style type='text/css'>
  161.                     .post-content #checklist-1 li:before{color:<?php echo $iconcolor; ?> !important;}
  162.                     .rtl .post-content #checklist-1 li:after{color:<?php echo $iconcolor; ?> !important;}
  163.                 </style>
  164.  
  165.                 <?php wp_nav_menu(array('theme_location' => '404_pages', 'depth' => 1, 'container' => false, 'menu_id' => 'checklist-1', 'menu_class' => 'list-icon circle-yes list-icon-arrow')); ?>
  166.             </div>
  167.             <div class="fusion-one-third one_third fusion-column last">
  168.                 <h3><?php echo __('Try again!', 'Avada'); ?></a></h3>
  169.                 <p><?php echo __('If you want to rephrase your query, here is your chance:', 'Avada'); ?></p>
  170.                 <form id="searchform" class="seach-form" role="search" method="get" action="<?php echo home_url( '/' ); ?>">
  171.                     <div class="search-table">
  172.                         <div class="search-field">
  173.                             <input type="text" value="" name="s" id="s" placeholder="<?php _e( 'Search ...', 'Avada' ); ?>"/>
  174.                         </div>
  175.                         <div class="search-button">
  176.                             <input type="submit" id="searchsubmit" value="&#xf002;" />
  177.                         </div>
  178.                     </div>
  179.                 </form>
  180.             </div>
  181.         </div>
  182.     </div>
  183.     <?php endif; ?>
  184.     </div>
  185.     <?php if( $sidebar_exists == true ): ?>
  186.     <?php wp_reset_query(); ?>
  187.     <div id="sidebar" class="sidebar" style="<?php echo $sidebar_css; ?>">
  188.         <?php
  189.         if($sidebar_left == 1) {
  190.             generated_dynamic_sidebar($sidebar_1);
  191.         }
  192.         if($sidebar_left == 2) {
  193.             generated_dynamic_sidebar_2($sidebar_2);
  194.         }
  195.         ?>
  196.     </div>
  197.     <?php if( $double_sidebars == true ): ?>
  198.     <div id="sidebar-2" class="sidebar" style="<?php echo $sidebar_2_css; ?>">
  199.         <?php
  200.         if($sidebar_left == 1) {
  201.             generated_dynamic_sidebar_2($sidebar_2);
  202.         }
  203.         if($sidebar_left == 2) {
  204.             generated_dynamic_sidebar($sidebar_1);
  205.         }
  206.         ?>
  207.     </div>
  208.     <?php endif; ?>
  209.     <?php endif; ?>
  210. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement