Changeset 606086
- Timestamp:
- 09/30/2012 11:39:58 AM (12 years ago)
- Location:
- cat-tag-filter-widget
- Files:
-
- 11 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cat-tag-filter-widget/trunk/cat-tag-filter.php
r605991 r606086 5 5 Description: This plugin adds a widget to your WordPress site that allows your visitors to filter posts by category and tag. 6 6 Author: Ajay Verma 7 Version: 0.8 7 Version: 0.8.1 8 8 Author URI: http://ajayver.com/ 9 9 */ … … 90 90 global $ctf_options, $current_tax; 91 91 92 if ($ctf_options['exclude_tags'] != '') $args[$ctf_options['clude_tags']] = $ctf_options['exclude_tags'];93 else $args = '';92 //if ($ctf_options['exclude_tags'] != '') $args[$ctf_options['clude_tags']] = $ctf_options['exclude_tags']; 93 //else $args = ''; 94 94 if($current_tax[cats][0]){ 95 95 … … 100 100 if(have_posts()): while (have_posts()) : the_post(); 101 101 $all_tag_objects = get_the_terms($post->ID, $ctf_options['tag_tax']); 102 if($all_tag_objects){ 103 $ctf_options['exclude_tags'] = str_replace(" ", "", $ctf_options['exclude_tags']); 104 $exclude = explode(',', $ctf_options['exclude_tags']); 102 if($all_tag_objects){ 105 103 foreach($all_tag_objects as $tag) { 106 if($tag->count > 0) { 107 if (!in_array($tag->term_id, $exclude)) $all_tag_ids[] = $tag->term_id; 108 } 104 if($tag->count > 0) $all_tag_ids[] = $tag->term_id; 109 105 } 110 106 } … … 113 109 $tags = array_unique($all_tag_ids); 114 110 if (!empty($tags)){ 115 foreach ($tags as $tag){ 116 $include .= $tag . ','; 117 } 111 if ($ctf_options['exclude_tags'] != ''){ 112 $ctf_options['exclude_tags'] = str_replace(" ", "", $ctf_options['exclude_tags']); 113 $exclude = explode(',', $ctf_options['exclude_tags']); 114 } 115 116 if ($ctf_options['clude_tags'] == 'include') { 117 foreach ($tags as $tag){ 118 if (in_array($tag, $exclude)) $include .= $tag . ','; 119 } 120 } 121 else if ($ctf_options['clude_tags'] == 'exclude') { 122 foreach ($tags as $tag){ 123 if (!in_array($tag, $exclude)) $include .= $tag . ','; 124 } 125 } 126 118 127 $include = substr($include, 0, -1); 119 128 $args['include'] = $include; -
cat-tag-filter-widget/trunk/readme.txt
r606003 r606086 74 74 == Changelog == 75 75 76 = 0.8.1 = 77 * fixed a bug with tags including\excluding. 78 76 79 = 0.8 = 77 80 * Widget shows only corresponding tags for a chosen category.
Note: See TracChangeset
for help on using the changeset viewer.