Plugin Directory

Changeset 548888


Ignore:
Timestamp:
05/25/2012 09:03:14 AM (13 years ago)
Author:
ajayver
Message:
 
Location:
cat-tag-filter-widget
Files:
11 added
1 edited

Legend:

Unmodified
Added
Removed
  • cat-tag-filter-widget/trunk/cat-tag-filter.php

    r536741 r548888  
    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.6
     7Version: 0.7
    88Author URI: http://ajayver.com/
    99*/
     
    8787  global $ctf_options, $current_tax;
    8888 
    89   if ($ctf_options['exclude_tags'] != '') $args = 'exclude=' . $ctf_options['exclude_tags'];
     89  if ($ctf_options['exclude_tags'] != '') $args['exclude'] = $ctf_options['exclude_tags'];
    9090  else $args = '';
     91  if($current_tax[cats][0]){
     92
     93  $cat_args = array(
     94    'cat'      => $current_tax[cats][0]
     95);
     96query_posts($cat_args);
     97    if(have_posts()): while (have_posts()) : the_post();
     98        $all_tag_objects = get_the_terms($post->ID, $ctf_options['tag_tax']);
     99        if($all_tag_objects){
     100            $ctf_options['exclude_tags'] = str_replace(" ", "", $ctf_options['exclude_tags']);
     101            $exclude = explode(',', $ctf_options['exclude_tags']);
     102            foreach($all_tag_objects as $tag) {
     103                if($tag->count > 0) {
     104                if (!in_array($tag->term_id, $exclude)) $all_tag_ids[] = $tag->term_id;
     105                }
     106            }
     107        }
     108    endwhile;
     109    endif;
     110    $tags = array_unique($all_tag_ids);
     111    if (!empty($tags)){
     112        foreach ($tags as $tag){
     113        $include .= $tag . ',';
     114        }
     115        $include = substr($include, 0, -1);
     116        $args['include'] = $include;
     117   
     118    }
     119   
     120}
    91121  $tags = get_terms($ctf_options['tag_tax'],$args);
     122
     123 
    92124  if ($type == 1){
    93125   $options .= '<ul>';
Note: See TracChangeset for help on using the changeset viewer.