Search & Filter - Version 1.2.3

Version Description

  • Added arguement all_items_labels which allows for support for custom all_items labels in taxonomies, categories, post tags and post types when using select and radio types - the default text displaying "All Categories" for example can now be defined using all_items_labels
  • Added show_count to arguments - this shows how many posts are in a particular term, in brackets after the term name - works only for categories, tags and taxonomies
  • Fixed a bug when using when using "all post types" and it displaying no results
  • Reverted behaviour from 1.2.2 - no longer force load search template when search is blank - let WP handle it again
  • Added argument add_search_param - setting it to 1 will force a "?s=" or "&s=" to be added to the url even when the search is blank - in some circumstances this will force load the search template, instead of other WP templates, such as taxonomy or category templates
Download this release

Release Info

Developer DesignsAndCode
Plugin Icon 128x128 Search & Filter
Version 1.2.3
Comparing to
See all releases

Code changes from version 1.2.2 to 1.2.3

Files changed (2) hide show
  1. readme.txt +8 -1
  2. search-filter.php +101 -46
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: category, filter, taxonomy, search, wordpress, post type, post date
5
  Requires at least: 3.5
6
  Tested up to: 3.8
7
- Stable tag: 1.2.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -34,6 +34,13 @@ The documentation has been updated to include examples almost all configurable o
34
 
35
  == Changelog ==
36
 
 
 
 
 
 
 
 
37
  = 1.2.2 =
38
  * Added support for multi selects - use `multiselect` as the type for your field
39
  * Added support for AND & OR operators when using checkboxes or multiselects - use the `operators` argument with allowed values of `and` & `or`
4
  Tags: category, filter, taxonomy, search, wordpress, post type, post date
5
  Requires at least: 3.5
6
  Tested up to: 3.8
7
+ Stable tag: 1.2.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
34
 
35
  == Changelog ==
36
 
37
+ = 1.2.3 =
38
+ * Added arguement `all_items_labels` which allows for support for custom `all_items` labels in taxonomies, categories, post tags and post types when using `select` and `radio` types - the default text displaying "All Categories" for example can now be defined using `all_items_labels`
39
+ * Added `show_count` to arguments - this shows how many posts are in a particular term, in brackets after the term name - works only for categories, tags and taxonomies
40
+ * Fixed a bug when using when using "all post types" and it displaying no results
41
+ * Reverted behaviour from 1.2.2 - no longer force load search template when search is blank - let WP handle it again
42
+ * Added argument `add_search_param` - setting it to `1` will force a "?s=" or "&s=" to be added to the url even when the search is blank - in some circumstances this will force load the search template, instead of other WP templates, such as taxonomy or category templates
43
+
44
  = 1.2.2 =
45
  * Added support for multi selects - use `multiselect` as the type for your field
46
  * Added support for AND & OR operators when using checkboxes or multiselects - use the `operators` argument with allowed values of `and` & `or`
search-filter.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.designsandcode.com/447/wordpress-search-filter-plugin-for
5
  Description: Search and Filtering system for Pages, Posts, Categories, Tags and Taxonomies
6
  Author: Designs & Code
7
  Author URI: http://www.designsandcode.com/
8
- Version: 1.2.2
9
  Text Domain: searchandfilter
10
  License: GPLv2
11
  */
@@ -16,7 +16,7 @@ License: GPLv2
16
  * Set up Plugin Globals
17
  */
18
  if (!defined('SEARCHANDFILTER_VERSION_NUM'))
19
- define('SEARCHANDFILTER_VERSION_NUM', '1.2.2');
20
 
21
  if (!defined('SEARCHANDFILTER_THEME_DIR'))
22
  define('SEARCHANDFILTER_THEME_DIR', ABSPATH . 'wp-content/themes/' . get_template());
@@ -61,6 +61,7 @@ if ( ! class_exists( 'SearchAndFilter' ) )
61
  private $defaults = array();
62
  private $frmreserved = array();
63
  private $taxonomylist = array();
 
64
 
65
  public function __construct()
66
  {
@@ -76,30 +77,21 @@ if ( ! class_exists( 'SearchAndFilter' ) )
76
  add_filter('pre_get_posts', array($this,'filter_query_post_types'));
77
  add_filter('pre_get_posts', array($this,'filter_query_post_date'));
78
 
 
 
79
  // Add shortcode support for widgets
80
  add_shortcode('searchandfilter', array($this, 'shortcode'));
81
  add_filter('widget_text', 'do_shortcode');
82
 
83
- //force search template if `?s=` is in the url
84
- add_filter( 'request', array($this, 'force_search_template') );
85
-
86
  // Check the header to see if the form has been submitted
87
  add_action( 'get_header', array( $this, 'check_posts' ) );
88
 
89
  // Add styles
90
  add_action( 'wp_enqueue_scripts', array($this, 'of_enqueue_styles') );
91
  add_action( 'admin_enqueue_scripts', array($this, 'of_enqueue_admin_ss') );
 
92
  }
93
 
94
- function force_search_template( $query_vars )
95
- {
96
- if( isset( $_GET['s'] ) && empty( $_GET['s'] ) ) {
97
- $query_vars['s'] = " ";
98
- }
99
- return $query_vars;
100
- }
101
-
102
-
103
  public function of_enqueue_styles()
104
  {
105
  wp_enqueue_style( 'searchandfilter', SEARCHANDFILTER_PLUGIN_URL . '/style.css', false, 1.0, 'all' );
@@ -113,7 +105,7 @@ if ( ! class_exists( 'SearchAndFilter' ) )
113
  wp_enqueue_script( 'of_syntax_script', SEARCHANDFILTER_PLUGIN_URL.'/admin/syntax.highlight.min.js' );
114
  }
115
  }
116
-
117
  public function shortcode($atts, $content = null)
118
  {
119
  // extract the attributes into variables
@@ -127,6 +119,7 @@ if ( ! class_exists( 'SearchAndFilter' ) )
127
  'types' => "",
128
  'type' => "", //will be deprecated - use `types` instead
129
  'headings' => "",
 
130
  'class' => "",
131
  'post_types' => "",
132
  'hierarchical' => "",
@@ -134,7 +127,8 @@ if ( ! class_exists( 'SearchAndFilter' ) )
134
  'order_by' => "",
135
  'show_count' => "",
136
  'order_dir' => "",
137
- 'operators' => ""
 
138
 
139
  ), $atts));
140
 
@@ -151,12 +145,10 @@ if ( ! class_exists( 'SearchAndFilter' ) )
151
  $this->taxonomylist = $fields;
152
  $nofields = count($fields);
153
 
154
-
155
- // Force blank searches to be registered as a valid search and load the search template
156
- /*if($force_search_template==1)
157
  {
158
- add_filter( 'request', array($this, 'force_blank_search') );
159
- }*/
160
 
161
  //init `submitlabel`
162
  if($submitlabel!=null)
@@ -258,11 +250,18 @@ if ( ! class_exists( 'SearchAndFilter' ) )
258
 
259
  //init `labels`
260
  $labels = explode(",",$headings);
261
- $labeldefault = "name";
262
-
263
  if(!is_array($labels))
264
  {
265
- $labels = array("default");
 
 
 
 
 
 
 
 
266
  }
267
 
268
  //init `types`
@@ -326,6 +325,12 @@ if ( ! class_exists( 'SearchAndFilter' ) )
326
  $labels[$i] = "";
327
  }
328
 
 
 
 
 
 
 
329
 
330
  if(isset($order_by[$i]))
331
  {
@@ -369,7 +374,7 @@ if ( ! class_exists( 'SearchAndFilter' ) )
369
  //set all form defaults / dropdowns etc
370
  $this->set_defaults();
371
 
372
- return $this->get_search_filter_form($submit_label, $search_placeholder, $fields, $types, $labels, $hierarchical, $hide_empty, $show_count, $post_types, $order_by, $order_dir, $operators, $class);
373
  }
374
 
375
 
@@ -458,6 +463,17 @@ if ( ! class_exists( 'SearchAndFilter' ) )
458
  remove_filter( 'posts_where', 'limit_date_range_query' );
459
  }
460
 
 
 
 
 
 
 
 
 
 
 
 
461
  function filter_query_post_date($query)
462
  {
463
  global $wp_query;
@@ -718,7 +734,7 @@ if ( ! class_exists( 'SearchAndFilter' ) )
718
  }
719
  if(!$this->hassearchquery)
720
  {
721
- if((isset($_POST[SF_FPRE.'search_is_set']))&&($this->has_form_posted))
722
  {//this is only set when a search box is displayed - it tells S&F to append a blank search to the URL to indicate a search has been submitted with no terms, however, still load the search template
723
 
724
  if(!$this->hasqmark)
@@ -1017,16 +1033,18 @@ if ( ! class_exists( 'SearchAndFilter' ) )
1017
 
1018
  if($this->has_form_posted)
1019
  {//if the search has been posted, redirect to the newly formed url with all the right params
1020
-
1021
- if($this->urlparams=="/")
1022
  {//check to see if url params are set, if not ("/") then add "?s=" to force load search results, without this it would redirect to the homepage, which may be a custom page with no blog items/results
 
1023
  $this->urlparams .= "?s=";
1024
- }
 
1025
  wp_redirect( (home_url().$this->urlparams) );
1026
  }
1027
  }
1028
 
1029
- public function get_search_filter_form($submitlabel, $search_placeholder, $fields, $types, $labels, $hierarchical, $hide_empty, $show_count, $post_types, $order_by, $order_dir, $operators, $class)
1030
  {
1031
  $returnvar = '';
1032
 
@@ -1069,7 +1087,6 @@ if ( ! class_exists( 'SearchAndFilter' ) )
1069
  }
1070
  $clean_searchterm = (esc_attr($this->searchterm));
1071
  $returnvar .= '<input type="text" name="'.SF_FPRE.'search" placeholder="'.$search_placeholder.'" value="'.$clean_searchterm.'">';
1072
- $returnvar .= "<input type=\"hidden\" name=\"".SF_FPRE."search_is_set\" value=\"1\" />";
1073
  $returnvar .= '</li>';
1074
  }
1075
  else if($field == "post_types") //a post can only every have 1 type, so checkboxes & multiselects will always be "OR"
@@ -1087,7 +1104,7 @@ if ( ! class_exists( 'SearchAndFilter' ) )
1087
  }*/
1088
 
1089
 
1090
- $returnvar .= $this->build_post_type_element($types, $labels, $post_types, $field, $i);
1091
 
1092
  }
1093
  else if($field == 'post_date')
@@ -1096,15 +1113,21 @@ if ( ! class_exists( 'SearchAndFilter' ) )
1096
  }
1097
  else
1098
  {
1099
- $returnvar .= $this->build_taxonomy_element($types, $labels, $field, $hierarchical, $hide_empty, $show_count, $order_by, $order_dir, $operators, $i);
1100
  }
1101
  $i++;
1102
 
1103
  }
1104
 
 
 
 
 
 
 
 
1105
  $returnvar .=
1106
- '<li>
1107
- <input type="hidden" name="'.SF_FPRE.'submitted" value="1">
1108
  <input type="submit" value="'.$submitlabel.'">
1109
  </li>';
1110
 
@@ -1149,7 +1172,7 @@ if ( ! class_exists( 'SearchAndFilter' ) )
1149
  }
1150
 
1151
 
1152
- function build_post_type_element($types, $labels, $post_types, $field, $i)
1153
  {
1154
  $returnvar = "";
1155
  $taxonomychildren = array();
@@ -1211,7 +1234,15 @@ if ( ! class_exists( 'SearchAndFilter' ) )
1211
  $post_type_labels['name'] = "Post Types";
1212
  $post_type_labels['singular_name'] = "Post Type";
1213
  $post_type_labels['search_items'] = "Search Post Types";
1214
- $post_type_labels['all_items'] = "All Post Types";
 
 
 
 
 
 
 
 
1215
 
1216
  $post_type_labels = (object)$post_type_labels;
1217
 
@@ -1222,7 +1253,7 @@ if ( ! class_exists( 'SearchAndFilter' ) )
1222
 
1223
  if($post_type_count>0)
1224
  {
1225
- $defaultval = implode("+",$post_types);
1226
  }
1227
  else
1228
  {
@@ -1248,7 +1279,7 @@ if ( ! class_exists( 'SearchAndFilter' ) )
1248
  }
1249
 
1250
  //gets all the data for the taxonomy then display as form element
1251
- function build_taxonomy_element($types, $labels, $taxonomy, $hierarchical, $hide_empty, $show_count, $order_by, $order_dir, $operators, $i)
1252
  {
1253
  $returnvar = "";
1254
 
@@ -1274,7 +1305,9 @@ if ( ! class_exists( 'SearchAndFilter' ) )
1274
  'order' => $order_dir[$i],
1275
  'orderby' => $order_by[$i],
1276
  'show_option_none' => '',
1277
- 'show_count' => '0'
 
 
1278
  );
1279
 
1280
  if(isset($hierarchical[$i]))
@@ -1301,18 +1334,24 @@ if ( ! class_exists( 'SearchAndFilter' ) )
1301
  }
1302
  }
1303
 
 
 
 
 
 
 
 
1304
  $taxonomychildren = get_categories($args);
1305
 
1306
  if($types[$i]=="select")
1307
  {
1308
-
1309
  $returnvar .= $this->generate_wp_dropdown($args, $taxonomy, $this->tagid, $taxonomydata->labels);
1310
  }
1311
  else if($types[$i]=="checkbox")
1312
  {
1313
  $args['title_li'] = '';
1314
  $args['defaults'] = $this->defaults[$args['name']];
1315
- $args['show_option_all'] = 0;
1316
 
1317
  $returnvar .= $this->generate_wp_checkbox($args, $taxonomy, $this->tagid, $taxonomydata->labels);
1318
  }
@@ -1320,7 +1359,6 @@ if ( ! class_exists( 'SearchAndFilter' ) )
1320
  {
1321
  $args['title_li'] = '';
1322
  $args['defaults'] = $this->defaults[$args['name']];
1323
- $args['show_option_all'] = 0;
1324
 
1325
  $returnvar .= $this->generate_wp_radio($args, $taxonomy, $this->tagid, $taxonomydata->labels);
1326
  }
@@ -1328,7 +1366,6 @@ if ( ! class_exists( 'SearchAndFilter' ) )
1328
  {
1329
  $args['title_li'] = '';
1330
  $args['defaults'] = $this->defaults[$args['name']];
1331
- $args['show_option_all'] = 0;
1332
 
1333
  $returnvar .= $this->generate_wp_multiselect($args, $taxonomy, $this->tagid, $taxonomydata->labels);
1334
  }
@@ -1359,7 +1396,15 @@ if ( ! class_exists( 'SearchAndFilter' ) )
1359
  public function generate_wp_dropdown($args, $name, $currentid = 0, $labels = null, $defaultval = "0")
1360
  {
1361
  $returnvar = '';
1362
- $args['show_option_all'] = $labels->all_items != "" ? $labels->all_items : 'All ' . $labels->name;
 
 
 
 
 
 
 
 
1363
 
1364
  if(isset($this->defaults[SF_FPRE.$name]))
1365
  {
@@ -1402,9 +1447,19 @@ if ( ! class_exists( 'SearchAndFilter' ) )
1402
  //use wp array walker to enable hierarchical display
1403
  public function generate_wp_radio($args, $name, $currentid = 0, $labels = null, $defaultval = "0")
1404
  {
 
 
 
 
 
 
 
 
 
 
1405
  $checked = ($defaultval=="0") ? " checked='checked'" : "";
1406
  $returnvar = '<ul>';
1407
- $returnvar .= '<li>'."<label><input type='radio' name='".$args['name']."[]' value='0'$checked /> ".$labels->all_items."</label>".'</li>';
1408
  $returnvar .= walk_taxonomy('radio', $args);
1409
  $returnvar .= "</ul>";
1410
 
5
  Description: Search and Filtering system for Pages, Posts, Categories, Tags and Taxonomies
6
  Author: Designs & Code
7
  Author URI: http://www.designsandcode.com/
8
+ Version: 1.2.3
9
  Text Domain: searchandfilter
10
  License: GPLv2
11
  */
16
  * Set up Plugin Globals
17
  */
18
  if (!defined('SEARCHANDFILTER_VERSION_NUM'))
19
+ define('SEARCHANDFILTER_VERSION_NUM', '1.2.3');
20
 
21
  if (!defined('SEARCHANDFILTER_THEME_DIR'))
22
  define('SEARCHANDFILTER_THEME_DIR', ABSPATH . 'wp-content/themes/' . get_template());
61
  private $defaults = array();
62
  private $frmreserved = array();
63
  private $taxonomylist = array();
64
+ private $add_search_param = 1;
65
 
66
  public function __construct()
67
  {
77
  add_filter('pre_get_posts', array($this,'filter_query_post_types'));
78
  add_filter('pre_get_posts', array($this,'filter_query_post_date'));
79
 
80
+ //add_filter('pre_get_posts',array($this, 'fix_blank_search')); //temporaril disabled
81
+
82
  // Add shortcode support for widgets
83
  add_shortcode('searchandfilter', array($this, 'shortcode'));
84
  add_filter('widget_text', 'do_shortcode');
85
 
 
 
 
86
  // Check the header to see if the form has been submitted
87
  add_action( 'get_header', array( $this, 'check_posts' ) );
88
 
89
  // Add styles
90
  add_action( 'wp_enqueue_scripts', array($this, 'of_enqueue_styles') );
91
  add_action( 'admin_enqueue_scripts', array($this, 'of_enqueue_admin_ss') );
92
+
93
  }
94
 
 
 
 
 
 
 
 
 
 
95
  public function of_enqueue_styles()
96
  {
97
  wp_enqueue_style( 'searchandfilter', SEARCHANDFILTER_PLUGIN_URL . '/style.css', false, 1.0, 'all' );
105
  wp_enqueue_script( 'of_syntax_script', SEARCHANDFILTER_PLUGIN_URL.'/admin/syntax.highlight.min.js' );
106
  }
107
  }
108
+
109
  public function shortcode($atts, $content = null)
110
  {
111
  // extract the attributes into variables
119
  'types' => "",
120
  'type' => "", //will be deprecated - use `types` instead
121
  'headings' => "",
122
+ 'all_items_labels' => "",
123
  'class' => "",
124
  'post_types' => "",
125
  'hierarchical' => "",
127
  'order_by' => "",
128
  'show_count' => "",
129
  'order_dir' => "",
130
+ 'operators' => "",
131
+ 'add_search_param' => ""
132
 
133
  ), $atts));
134
 
145
  $this->taxonomylist = $fields;
146
  $nofields = count($fields);
147
 
148
+ if($add_search_param==0)
 
 
149
  {
150
+ $this->add_search_param = $add_search_param;
151
+ }
152
 
153
  //init `submitlabel`
154
  if($submitlabel!=null)
250
 
251
  //init `labels`
252
  $labels = explode(",",$headings);
253
+
 
254
  if(!is_array($labels))
255
  {
256
+ $labels = array();
257
+ }
258
+
259
+ //init `all_items_labels`
260
+ $all_items_labels = explode(",",$all_items_labels);
261
+
262
+ if(!is_array($all_items_labels))
263
+ {
264
+ $all_items_labels = array();
265
  }
266
 
267
  //init `types`
325
  $labels[$i] = "";
326
  }
327
 
328
+ //setup all_items_labels
329
+ if(!isset($all_items_labels[$i]))
330
+ {
331
+ $all_items_labels[$i] = "";
332
+ }
333
+
334
 
335
  if(isset($order_by[$i]))
336
  {
374
  //set all form defaults / dropdowns etc
375
  $this->set_defaults();
376
 
377
+ return $this->get_search_filter_form($submit_label, $search_placeholder, $fields, $types, $labels, $hierarchical, $hide_empty, $show_count, $post_types, $order_by, $order_dir, $operators, $all_items_labels, $class);
378
  }
379
 
380
 
463
  remove_filter( 'posts_where', 'limit_date_range_query' );
464
  }
465
 
466
+ function fix_blank_search($query)
467
+ {//needs to be re-implemented
468
+
469
+ if((isset($_GET['s'])) && (empty($_GET['s'])) && ($query->is_main_query()))
470
+ {
471
+ $query->is_search = true;
472
+ $query->is_home = false;
473
+ }
474
+
475
+ }
476
+
477
  function filter_query_post_date($query)
478
  {
479
  global $wp_query;
734
  }
735
  if(!$this->hassearchquery)
736
  {
737
+ if((isset($_POST[SF_FPRE.'add_search_param']))&&($this->has_form_posted))
738
  {//this is only set when a search box is displayed - it tells S&F to append a blank search to the URL to indicate a search has been submitted with no terms, however, still load the search template
739
 
740
  if(!$this->hasqmark)
1033
 
1034
  if($this->has_form_posted)
1035
  {//if the search has been posted, redirect to the newly formed url with all the right params
1036
+
1037
+ /*if($this->urlparams=="/")
1038
  {//check to see if url params are set, if not ("/") then add "?s=" to force load search results, without this it would redirect to the homepage, which may be a custom page with no blog items/results
1039
+ //echo "HERE";exit;
1040
  $this->urlparams .= "?s=";
1041
+ }*/
1042
+
1043
  wp_redirect( (home_url().$this->urlparams) );
1044
  }
1045
  }
1046
 
1047
+ public function get_search_filter_form($submitlabel, $search_placeholder, $fields, $types, $labels, $hierarchical, $hide_empty, $show_count, $post_types, $order_by, $order_dir, $operators, $all_items_labels, $class)
1048
  {
1049
  $returnvar = '';
1050
 
1087
  }
1088
  $clean_searchterm = (esc_attr($this->searchterm));
1089
  $returnvar .= '<input type="text" name="'.SF_FPRE.'search" placeholder="'.$search_placeholder.'" value="'.$clean_searchterm.'">';
 
1090
  $returnvar .= '</li>';
1091
  }
1092
  else if($field == "post_types") //a post can only every have 1 type, so checkboxes & multiselects will always be "OR"
1104
  }*/
1105
 
1106
 
1107
+ $returnvar .= $this->build_post_type_element($types, $labels, $post_types, $field, $all_items_labels, $i);
1108
 
1109
  }
1110
  else if($field == 'post_date')
1113
  }
1114
  else
1115
  {
1116
+ $returnvar .= $this->build_taxonomy_element($types, $labels, $field, $hierarchical, $hide_empty, $show_count, $order_by, $order_dir, $operators, $all_items_labels, $i);
1117
  }
1118
  $i++;
1119
 
1120
  }
1121
 
1122
+ $returnvar .='<li>';
1123
+
1124
+ if($this->add_search_param==1)
1125
+ {
1126
+ $returnvar .= "<input type=\"hidden\" name=\"".SF_FPRE."add_search_param\" value=\"1\" />";
1127
+ }
1128
+
1129
  $returnvar .=
1130
+ '<input type="hidden" name="'.SF_FPRE.'submitted" value="1">
 
1131
  <input type="submit" value="'.$submitlabel.'">
1132
  </li>';
1133
 
1172
  }
1173
 
1174
 
1175
+ function build_post_type_element($types, $labels, $post_types, $field, $all_items_labels, $i)
1176
  {
1177
  $returnvar = "";
1178
  $taxonomychildren = array();
1234
  $post_type_labels['name'] = "Post Types";
1235
  $post_type_labels['singular_name'] = "Post Type";
1236
  $post_type_labels['search_items'] = "Search Post Types";
1237
+
1238
+ if($all_items_labels[$i]!="")
1239
+ {
1240
+ $post_type_labels['all_items'] = $all_items_labels[$i];
1241
+ }
1242
+ else
1243
+ {
1244
+ $post_type_labels['all_items'] = "All Post Types";
1245
+ }
1246
 
1247
  $post_type_labels = (object)$post_type_labels;
1248
 
1253
 
1254
  if($post_type_count>0)
1255
  {
1256
+ $defaultval = implode(",",$post_types);
1257
  }
1258
  else
1259
  {
1279
  }
1280
 
1281
  //gets all the data for the taxonomy then display as form element
1282
+ function build_taxonomy_element($types, $labels, $taxonomy, $hierarchical, $hide_empty, $show_count, $order_by, $order_dir, $operators, $all_items_labels, $i)
1283
  {
1284
  $returnvar = "";
1285
 
1305
  'order' => $order_dir[$i],
1306
  'orderby' => $order_by[$i],
1307
  'show_option_none' => '',
1308
+ 'show_count' => '0',
1309
+ 'show_option_all' => '',
1310
+ 'show_option_all_sf' => ''
1311
  );
1312
 
1313
  if(isset($hierarchical[$i]))
1334
  }
1335
  }
1336
 
1337
+ if($all_items_labels[$i]!="")
1338
+ {
1339
+ $args['show_option_all_sf'] = $all_items_labels[$i];
1340
+ }
1341
+
1342
+
1343
+
1344
  $taxonomychildren = get_categories($args);
1345
 
1346
  if($types[$i]=="select")
1347
  {
 
1348
  $returnvar .= $this->generate_wp_dropdown($args, $taxonomy, $this->tagid, $taxonomydata->labels);
1349
  }
1350
  else if($types[$i]=="checkbox")
1351
  {
1352
  $args['title_li'] = '';
1353
  $args['defaults'] = $this->defaults[$args['name']];
1354
+ //$args['show_option_all'] = 0;
1355
 
1356
  $returnvar .= $this->generate_wp_checkbox($args, $taxonomy, $this->tagid, $taxonomydata->labels);
1357
  }
1359
  {
1360
  $args['title_li'] = '';
1361
  $args['defaults'] = $this->defaults[$args['name']];
 
1362
 
1363
  $returnvar .= $this->generate_wp_radio($args, $taxonomy, $this->tagid, $taxonomydata->labels);
1364
  }
1366
  {
1367
  $args['title_li'] = '';
1368
  $args['defaults'] = $this->defaults[$args['name']];
 
1369
 
1370
  $returnvar .= $this->generate_wp_multiselect($args, $taxonomy, $this->tagid, $taxonomydata->labels);
1371
  }
1396
  public function generate_wp_dropdown($args, $name, $currentid = 0, $labels = null, $defaultval = "0")
1397
  {
1398
  $returnvar = '';
1399
+
1400
+ if($args['show_option_all_sf']=="")
1401
+ {
1402
+ $args['show_option_all'] = $labels->all_items != "" ? $labels->all_items : 'All ' . $labels->name;
1403
+ }
1404
+ else
1405
+ {
1406
+ $args['show_option_all'] = $args['show_option_all_sf'];
1407
+ }
1408
 
1409
  if(isset($this->defaults[SF_FPRE.$name]))
1410
  {
1447
  //use wp array walker to enable hierarchical display
1448
  public function generate_wp_radio($args, $name, $currentid = 0, $labels = null, $defaultval = "0")
1449
  {
1450
+
1451
+ if($args['show_option_all_sf']=="")
1452
+ {
1453
+ $show_option_all = $labels->all_items != "" ? $labels->all_items : 'All ' . $labels->name;
1454
+ }
1455
+ else
1456
+ {
1457
+ $show_option_all = $args['show_option_all_sf'];
1458
+ }
1459
+
1460
  $checked = ($defaultval=="0") ? " checked='checked'" : "";
1461
  $returnvar = '<ul>';
1462
+ $returnvar .= '<li>'."<label><input type='radio' name='".$args['name']."[]' value='0'$checked /> ".$show_option_all."</label>".'</li>';
1463
  $returnvar .= walk_taxonomy('radio', $args);
1464
  $returnvar .= "</ul>";
1465