web_dor_SearchFilter

The Business Responsive web dor SearchFilter function.

Description

web_dor_SearchFilter( $query ); 

Parameters (1)

0. $query
The query.

Usage

  1. if ( !function_exists( 'web_dor_SearchFilter' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4. // The query. 
  5. $query = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = web_dor_SearchFilter($query); 
  9.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function web_dor_SearchFilter($query) 
  2. if ($query->is_search or $query->is_feed) { 
  3. // Portfolio 
  4. if(!isset($_GET['inc-posts']) && !isset($_GET['inc-pages'])) { 
  5.  
  6. $query->set('post_type', array('post', 'page')); 
  7.  
  8. else 
  9. if ($_GET['inc-posts'] == "on" && $_GET['inc-pages'] != "on") { 
  10. $query->set('post_type', 'post'); 
  11. } else if ($_GET['inc-posts'] != "on" && $_GET['inc-pages'] == "on") { 
  12. $query->set('post_type', 'page'); 
  13. } else if ($_GET['inc-posts'] == "on" && $_GET['inc-pages'] == "on") { 
  14. $query->set('post_type', array('post', 'page')); 
  15. } else { 
  16. $query->set('post_type', ''); 
  17. if (isset($_GET['month']) && $_GET['month'] != "no") { 
  18. $query->set('year', substr($_GET['month'], 0, 4)); 
  19. $query->set('monthnum', substr($_GET['month'], 4, 2)); 
  20. //var_dump($query); 
  21. return $query;