Advertisement
zanpo

WooCommerce search.php

Jul 22nd, 2014
455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.10 KB | None | 0 0
  1. <?php get_header(); ?>
  2. <?php global $wp_query; ?>
  3. <?php
  4. jaw_template_set_var('posts', $wp_query);
  5. $post_types = jwOpt::get_option('search_posttypes', array('post', 'page'));
  6.  
  7. if (sizeof($post_types) > 0) {
  8.     foreach ($post_types as $i => $type) {
  9.         $q = array();
  10.         $q = $wp_query->query_vars;
  11.  
  12.         if ($type == 'product' && isset($_GET['orderby'])) {
  13.             $price = explode('-', $_GET['orderby']);
  14.             if (count($price) > 1) {
  15.                 $q['orderby'] = $price[0];
  16.                 $q['order'] = $price[1];
  17.             }
  18.         }
  19.  
  20.         $q['post_type'] = $type;
  21.  
  22.         $query = new WP_Query($q);
  23.         jaw_template_set_var($type, $query);
  24.        
  25.     }
  26. }
  27. ?>
  28. <!-- Row for main content area -->
  29. <div id="content" class="<?php echo implode(' ', jwLayout::content_width()); ?> columns builder-section" role="main">
  30.  
  31.     <h1><?php _e('Search Results for', 'jawtemplates'); ?> "<?php echo get_search_query(); ?>"</h1>
  32.     <?php
  33.     get_template_part('loop', 'search');
  34.     ?>
  35.  
  36. </div><!-- End Content row -->
  37.  
  38. <?php
  39. get_sidebar();
  40.  
  41. get_footer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement