Version Description
- Fixed - compatibility issues with WP 4.2.x
Download this release
Release Info
Developer | DesignsAndCode |
Plugin | Search & Filter |
Version | 1.2.6 |
Comparing to | |
See all releases |
Code changes from version 1.2.5 to 1.2.6
- of-taxonomy-walker.php +7 -7
- readme.txt +5 -2
- search-filter.php +16 -11
of-taxonomy-walker.php
CHANGED
@@ -12,7 +12,6 @@ class Taxonomy_Walker extends Walker_Category {
|
|
12 |
function __construct($type = 'checkbox', $defaults = array()) {
|
13 |
// fetch the list of term ids for the given post
|
14 |
//$this->term_ids = wp_get_post_terms( $post_id, $taxonomy, 'fields=ids' );
|
15 |
-
//var_dump($this->term_ids);
|
16 |
|
17 |
$this->type = $type;
|
18 |
$this->defaults = $defaults;
|
@@ -47,8 +46,8 @@ class Taxonomy_Walker extends Walker_Category {
|
|
47 |
if($this->type=="list")
|
48 |
{
|
49 |
extract($args);
|
50 |
-
|
51 |
-
$cat_name = esc_attr( $category->
|
52 |
$cat_name = apply_filters( 'list_cats', $cat_name, $category );
|
53 |
$link = '<a href="' . esc_url( get_term_link($category) ) . '" ';
|
54 |
if ( $use_desc_for_title == 0 || empty($category->description) )
|
@@ -110,13 +109,14 @@ class Taxonomy_Walker extends Walker_Category {
|
|
110 |
else if(($this->type=="checkbox")||($this->type=="radio"))
|
111 |
{
|
112 |
extract($args);
|
113 |
-
|
114 |
$cat_name = esc_attr( $category->name );
|
115 |
$cat_id = esc_attr( $category->term_id );
|
116 |
$cat_name = apply_filters( 'list_cats', $cat_name, $category );
|
117 |
|
118 |
//check a default has been set
|
119 |
$checked = "";
|
|
|
120 |
if($defaults)
|
121 |
{
|
122 |
$noselected = count($this->defaults);
|
@@ -133,7 +133,7 @@ class Taxonomy_Walker extends Walker_Category {
|
|
133 |
}
|
134 |
}
|
135 |
|
136 |
-
$link = "<label><input type='".$this->type."' name='".$
|
137 |
|
138 |
|
139 |
if ( !empty($show_count) )
|
@@ -162,7 +162,7 @@ class Taxonomy_Walker extends Walker_Category {
|
|
162 |
{
|
163 |
extract($args);
|
164 |
|
165 |
-
$cat_name = esc_attr( $category->
|
166 |
$cat_id = esc_attr( $category->term_id );
|
167 |
$cat_name = apply_filters( 'list_cats', $cat_name, $category );
|
168 |
|
@@ -225,7 +225,7 @@ class Taxonomy_Walker extends Walker_Category {
|
|
225 |
$pad = str_repeat(' ', $depth * 3);
|
226 |
|
227 |
$output .= "\t<option class=\"level-$depth\" value=\"".$category->term_id."\"";
|
228 |
-
$cat_name = apply_filters('list_cats', $category->
|
229 |
if ( $category->term_id == $args['selected'] )
|
230 |
$output .= ' selected="selected"';
|
231 |
$output .= '>';
|
12 |
function __construct($type = 'checkbox', $defaults = array()) {
|
13 |
// fetch the list of term ids for the given post
|
14 |
//$this->term_ids = wp_get_post_terms( $post_id, $taxonomy, 'fields=ids' );
|
|
|
15 |
|
16 |
$this->type = $type;
|
17 |
$this->defaults = $defaults;
|
46 |
if($this->type=="list")
|
47 |
{
|
48 |
extract($args);
|
49 |
+
|
50 |
+
$cat_name = esc_attr( $category->sf_name );
|
51 |
$cat_name = apply_filters( 'list_cats', $cat_name, $category );
|
52 |
$link = '<a href="' . esc_url( get_term_link($category) ) . '" ';
|
53 |
if ( $use_desc_for_title == 0 || empty($category->description) )
|
109 |
else if(($this->type=="checkbox")||($this->type=="radio"))
|
110 |
{
|
111 |
extract($args);
|
112 |
+
|
113 |
$cat_name = esc_attr( $category->name );
|
114 |
$cat_id = esc_attr( $category->term_id );
|
115 |
$cat_name = apply_filters( 'list_cats', $cat_name, $category );
|
116 |
|
117 |
//check a default has been set
|
118 |
$checked = "";
|
119 |
+
|
120 |
if($defaults)
|
121 |
{
|
122 |
$noselected = count($this->defaults);
|
133 |
}
|
134 |
}
|
135 |
|
136 |
+
$link = "<label><input type='".$this->type."' name='".$sf_name."[]' value='".$cat_id."'".$checked." /> ".$cat_name;
|
137 |
|
138 |
|
139 |
if ( !empty($show_count) )
|
162 |
{
|
163 |
extract($args);
|
164 |
|
165 |
+
$cat_name = esc_attr( $category->sf_name );
|
166 |
$cat_id = esc_attr( $category->term_id );
|
167 |
$cat_name = apply_filters( 'list_cats', $cat_name, $category );
|
168 |
|
225 |
$pad = str_repeat(' ', $depth * 3);
|
226 |
|
227 |
$output .= "\t<option class=\"level-$depth\" value=\"".$category->term_id."\"";
|
228 |
+
$cat_name = apply_filters('list_cats', $category->sf_name, $category);
|
229 |
if ( $category->term_id == $args['selected'] )
|
230 |
$output .= ' selected="selected"';
|
231 |
$output .= '>';
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: DesignsAndCode
|
|
3 |
Donate link:
|
4 |
Tags: category, filter, taxonomy, search, wordpress, post type, post date
|
5 |
Requires at least: 3.5
|
6 |
-
Tested up to: 4
|
7 |
-
Stable tag: 1.2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -34,6 +34,9 @@ The documentation has been updated to include examples almost all configurable o
|
|
34 |
|
35 |
== Changelog ==
|
36 |
|
|
|
|
|
|
|
37 |
= 1.2.5 =
|
38 |
* Fixed a PHP error when setting defaults for taxonomies - many users did not see this but resulted in unexpected behaviour
|
39 |
* Fixed an error with post date sometimes being undefined for blank searches
|
3 |
Donate link:
|
4 |
Tags: category, filter, taxonomy, search, wordpress, post type, post date
|
5 |
Requires at least: 3.5
|
6 |
+
Tested up to: 4.2.1
|
7 |
+
Stable tag: 1.2.6
|
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.6 =
|
38 |
+
* Fixed - compatibility issues with WP 4.2.x
|
39 |
+
|
40 |
= 1.2.5 =
|
41 |
* Fixed a PHP error when setting defaults for taxonomies - many users did not see this but resulted in unexpected behaviour
|
42 |
* Fixed an error with post date sometimes being undefined for blank searches
|
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.
|
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.
|
20 |
|
21 |
if (!defined('SEARCHANDFILTER_THEME_DIR'))
|
22 |
define('SEARCHANDFILTER_THEME_DIR', ABSPATH . 'wp-content/themes/' . get_template());
|
@@ -1234,7 +1234,6 @@ if ( ! class_exists( 'SearchAndFilter' ) )
|
|
1234 |
{
|
1235 |
foreach($post_types as $post_type)
|
1236 |
{
|
1237 |
-
//var_dump(get_post_type_object( $post_type ));
|
1238 |
$post_type_data = get_post_type_object( $post_type );
|
1239 |
|
1240 |
if($post_type_data)
|
@@ -1317,7 +1316,7 @@ if ( ! class_exists( 'SearchAndFilter' ) )
|
|
1317 |
}
|
1318 |
|
1319 |
$args = array(
|
1320 |
-
'
|
1321 |
'taxonomy' => $taxonomy,
|
1322 |
'hierarchical' => false,
|
1323 |
'child_of' => 0,
|
@@ -1373,9 +1372,9 @@ if ( ! class_exists( 'SearchAndFilter' ) )
|
|
1373 |
{
|
1374 |
$args['title_li'] = '';
|
1375 |
$args['defaults'] = "";
|
1376 |
-
if(isset($this->defaults[$args['
|
1377 |
{
|
1378 |
-
$args['defaults'] = $this->defaults[$args['
|
1379 |
}
|
1380 |
//$args['show_option_all'] = 0;
|
1381 |
|
@@ -1385,9 +1384,10 @@ if ( ! class_exists( 'SearchAndFilter' ) )
|
|
1385 |
{
|
1386 |
$args['title_li'] = '';
|
1387 |
$args['defaults'] = "";
|
1388 |
-
|
|
|
1389 |
{
|
1390 |
-
$args['defaults'] = $this->defaults[$args['
|
1391 |
}
|
1392 |
|
1393 |
$returnvar .= $this->generate_wp_radio($args, $taxonomy, $this->tagid, $taxonomydata->labels);
|
@@ -1396,6 +1396,7 @@ if ( ! class_exists( 'SearchAndFilter' ) )
|
|
1396 |
{
|
1397 |
$args['title_li'] = '';
|
1398 |
$args['defaults'] = "";
|
|
|
1399 |
if(isset($this->defaults[$args['name']]))
|
1400 |
{
|
1401 |
$args['defaults'] = $this->defaults[$args['name']];
|
@@ -1429,6 +1430,8 @@ if ( ! class_exists( 'SearchAndFilter' ) )
|
|
1429 |
//use wp array walker to enable hierarchical display
|
1430 |
public function generate_wp_dropdown($args, $name, $currentid = 0, $labels = null, $defaultval = "0")
|
1431 |
{
|
|
|
|
|
1432 |
$returnvar = '';
|
1433 |
|
1434 |
if($args['show_option_all_sf']=="")
|
@@ -1461,7 +1464,7 @@ if ( ! class_exists( 'SearchAndFilter' ) )
|
|
1461 |
//use wp array walker to enable hierarchical display
|
1462 |
public function generate_wp_multiselect($args, $name, $currentid = 0, $labels = null, $defaultval = "0")
|
1463 |
{
|
1464 |
-
$returnvar = '<select multiple="multiple" name="'.$args['
|
1465 |
$returnvar .= walk_taxonomy('multiselect', $args);
|
1466 |
$returnvar .= "</select>";
|
1467 |
|
@@ -1493,7 +1496,7 @@ if ( ! class_exists( 'SearchAndFilter' ) )
|
|
1493 |
|
1494 |
$checked = ($defaultval=="0") ? " checked='checked'" : "";
|
1495 |
$returnvar = '<ul>';
|
1496 |
-
$returnvar .= '<li>'."<label><input type='radio' name='".$args['
|
1497 |
$returnvar .= walk_taxonomy('radio', $args);
|
1498 |
$returnvar .= "</ul>";
|
1499 |
|
@@ -1693,7 +1696,9 @@ if ( ! class_exists( 'SearchAndFilter' ) )
|
|
1693 |
|
1694 |
function walk_taxonomy( $type = "checkbox", $args = array() ) {
|
1695 |
|
1696 |
-
$args['walker'] = new Taxonomy_Walker($type, $args['
|
|
|
|
|
1697 |
|
1698 |
$output = wp_list_categories($args);
|
1699 |
if ( $output )
|
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.6
|
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.6');
|
20 |
|
21 |
if (!defined('SEARCHANDFILTER_THEME_DIR'))
|
22 |
define('SEARCHANDFILTER_THEME_DIR', ABSPATH . 'wp-content/themes/' . get_template());
|
1234 |
{
|
1235 |
foreach($post_types as $post_type)
|
1236 |
{
|
|
|
1237 |
$post_type_data = get_post_type_object( $post_type );
|
1238 |
|
1239 |
if($post_type_data)
|
1316 |
}
|
1317 |
|
1318 |
$args = array(
|
1319 |
+
'sf_name' => SF_FPRE . $taxonomy,
|
1320 |
'taxonomy' => $taxonomy,
|
1321 |
'hierarchical' => false,
|
1322 |
'child_of' => 0,
|
1372 |
{
|
1373 |
$args['title_li'] = '';
|
1374 |
$args['defaults'] = "";
|
1375 |
+
if(isset($this->defaults[$args['sf_name']]))
|
1376 |
{
|
1377 |
+
$args['defaults'] = $this->defaults[$args['sf_name']];
|
1378 |
}
|
1379 |
//$args['show_option_all'] = 0;
|
1380 |
|
1384 |
{
|
1385 |
$args['title_li'] = '';
|
1386 |
$args['defaults'] = "";
|
1387 |
+
|
1388 |
+
if(isset($this->defaults[$args['sf_name']]))
|
1389 |
{
|
1390 |
+
$args['defaults'] = $this->defaults[$args['sf_name']];
|
1391 |
}
|
1392 |
|
1393 |
$returnvar .= $this->generate_wp_radio($args, $taxonomy, $this->tagid, $taxonomydata->labels);
|
1396 |
{
|
1397 |
$args['title_li'] = '';
|
1398 |
$args['defaults'] = "";
|
1399 |
+
|
1400 |
if(isset($this->defaults[$args['name']]))
|
1401 |
{
|
1402 |
$args['defaults'] = $this->defaults[$args['name']];
|
1430 |
//use wp array walker to enable hierarchical display
|
1431 |
public function generate_wp_dropdown($args, $name, $currentid = 0, $labels = null, $defaultval = "0")
|
1432 |
{
|
1433 |
+
$args['name'] = $args['sf_name'];
|
1434 |
+
|
1435 |
$returnvar = '';
|
1436 |
|
1437 |
if($args['show_option_all_sf']=="")
|
1464 |
//use wp array walker to enable hierarchical display
|
1465 |
public function generate_wp_multiselect($args, $name, $currentid = 0, $labels = null, $defaultval = "0")
|
1466 |
{
|
1467 |
+
$returnvar = '<select multiple="multiple" name="'.$args['sf_name'].'[]" class="postform">';
|
1468 |
$returnvar .= walk_taxonomy('multiselect', $args);
|
1469 |
$returnvar .= "</select>";
|
1470 |
|
1496 |
|
1497 |
$checked = ($defaultval=="0") ? " checked='checked'" : "";
|
1498 |
$returnvar = '<ul>';
|
1499 |
+
$returnvar .= '<li>'."<label><input type='radio' name='".$args['sf_name']."[]' value='0'$checked /> ".$show_option_all."</label>".'</li>';
|
1500 |
$returnvar .= walk_taxonomy('radio', $args);
|
1501 |
$returnvar .= "</ul>";
|
1502 |
|
1696 |
|
1697 |
function walk_taxonomy( $type = "checkbox", $args = array() ) {
|
1698 |
|
1699 |
+
$args['walker'] = new Taxonomy_Walker($type, $args['sf_name']);
|
1700 |
+
|
1701 |
+
//unset($args['sf_name']);
|
1702 |
|
1703 |
$output = wp_list_categories($args);
|
1704 |
if ( $output )
|