Plugin Directory

Changeset 606086


Ignore:
Timestamp:
09/30/2012 11:39:58 AM (12 years ago)
Author:
ajayver
Message:
 
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  
    55Description: This plugin adds a widget to your WordPress site that allows your visitors to filter posts by category and tag.
    66Author: Ajay Verma
    7 Version: 0.8
     7Version: 0.8.1
    88Author URI: http://ajayver.com/
    99*/
     
    9090  global $ctf_options, $current_tax;
    9191 
    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 = '';
    9494  if($current_tax[cats][0]){
    9595
     
    100100    if(have_posts()): while (have_posts()) : the_post();
    101101        $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){   
    105103            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;
    109105            }
    110106        }
     
    113109    $tags = array_unique($all_tag_ids);
    114110    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       
    118127        $include = substr($include, 0, -1);
    119128        $args['include'] = $include;
  • cat-tag-filter-widget/trunk/readme.txt

    r606003 r606086  
    7474== Changelog ==
    7575
     76= 0.8.1 =
     77* fixed a bug with tags including\excluding.
     78
    7679= 0.8 =
    7780* Widget shows only corresponding tags for a chosen category.
Note: See TracChangeset for help on using the changeset viewer.