Plugin Directory

Changeset 408941


Ignore:
Timestamp:
07/12/2011 09:52:45 PM (15 years ago)
Author:
jjcoder
Message:

Ability to filter results by tags. (Thanks to #henare)

Location:
jj-nextgen-jquery-slider/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • jj-nextgen-jquery-slider/trunk/includes/jj_ngg_jquery_slider.php

    r408907 r408941  
    2121    $height = $this->get_val_numeric($instance, 'height');
    2222    $order = $this->get_val($instance, 'order', 'asc', false);
     23    $tags = $this->get_val($instance, 'tags');
    2324    $shuffle = $this->get_val($instance, 'shuffle');
    2425    $limit = $this->get_val_numeric($instance, 'max_pictures');
     
    9899    $p_size = 0;
    99100    if(is_array($results))
    100     {
    101        $p_size = count($results);
     101    {           
     102      // Filter by tag if entered
     103      if($tags != '')
     104      {
     105        $tagged_images = nggTags::find_images_for_tags($tags);
     106     
     107        if($tagged_images)
     108        {
     109          $tagged_image_ids = array();
     110          foreach($tagged_images as $image)
     111          {
     112            $tagged_image_ids[] = $image->pid;
     113          }
     114         
     115          if(sizeof($tagged_image_ids) > 0)
     116          {     
     117            foreach($results as $result)
     118            {
     119              if(in_array($result->pid, $tagged_image_ids))
     120              {
     121                $filtered_results[] = $result;
     122              }
     123            }       
     124            $results = $filtered_results;
     125          }
     126        }
     127        else
     128        {
     129          $results = array();
     130        }
     131      }
     132     
     133      $p_size = count($results);             
    102134    }
    103135   
     
    359391      'height' => '',
    360392      'order' => 'random',
     393      'tags' => '',
    361394      'shuffle' => 'false',
    362395      'max_pictures' => '',
     
    443476  </p>
    444477  <p>
     478    <label for="<?php echo $this->get_field_id('tags'); ?>"><strong>Only display images tagged:</strong></label><br /><small>comma separated list<br/ >(Note: Doesn't work with Max pictures)</small><br />
     479    <input type="text" id="<?php echo $this->get_field_id('tags'); ?>" name="<?php echo $this->get_field_name('tags'); ?>" value="<?php echo $instance['tags']; ?>" class="widefat" />
     480  </p>   
     481  <p>
    445482    <label><strong>Shuffle:</strong> <small>(Only for random order)</small></label><br />
    446483    <input type="radio" id="<?php echo $this->get_field_id('shuffle'); ?>_true" name="<?php echo $this->get_field_name('shuffle'); ?>" value="true" style="vertical-align: middle;"<?php if($instance['shuffle'] == 'true') { echo " checked=\"checked\""; } ?> /><label for="<?php echo $this->get_field_id('shuffle'); ?>_true" style="vertical-align: middle;">true</label>
  • jj-nextgen-jquery-slider/trunk/jj-ngg-jquery-slider.php

    r408907 r408941  
    44Description: Allows you to pick a gallery from the 'NextGen Gallery' plugin to use as a 'JQuery Nivo Slider'.
    55Author: JJ Coder
    6 Version: 1.3.6
     6Version: 1.3.7
    77*/
    88
  • jj-nextgen-jquery-slider/trunk/readme.txt

    r408907 r408941  
    55Requires at least: 2.8
    66Tested up to: 3.2
    7 Stable tag: 1.3.6
     7Stable tag: 1.3.7
    88
    99Allows you to pick a gallery from the 'NextGen Gallery' plugin to use as a 'JQuery Nivo slider'.
     
    3131- Gallery: Leave blank to use all galleries or choose a gallery to use. (sc: gallery="galleryid")
    3232- Order: Order to display results in. You can choose; Random, Latest First, Oldest First, or NextGen Sortorder. Random will still work when a page is cached. (sc: order="random"|"asc"|"desc"|"sortorder")
     33- Tags: comma separated list of tags to filter results by. Note: Doesn't work with Max pictures parameter. (sc: tags="tag1, tag2")
    3334- Shuffle: If order is random and this is true will shuffle images with javascript. Useful if your are caching your pages. (sc: shuffle="true"|"false")
    3435- Max pictures: The maximum amount of pictures to use. (sc: max_pictures="6")
     
    162163== Changelog ==
    163164
     165- 1.3.7: Ability to filter results by tags. (Thanks to #henare)
    164166- 1.3.6: Got rid of border on image and added alt text even though alt text its pretty useless for nivo slider but should validate. (#Chad)
    165167- 1.3.5: Arrow fix. Make sure stylesheets and javascript is refreshed. (AGAIN!)
Note: See TracChangeset for help on using the changeset viewer.