Plugin Directory

Changeset 634634


Ignore:
Timestamp:
12/06/2012 12:45:41 AM (13 years ago)
Author:
randomaniac
Message:

Added the ability to sort the search results.

Location:
wp-flickr-embed/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-flickr-embed/trunk/README.txt

    r624015 r634634  
    1818= Features =
    1919* Search for an select any public photo or a private one from your photostream (requires Flickr authorization).
     20* Sort search results by date taken or date posted
    2021* Insert a photo anywhere in your post, choosing its title, size and how it should be aligned to the text.
    2122* Link the photo back to its Flickr page or to a different-sized version of itself.
  • wp-flickr-embed/trunk/wp-flickr-embed.js

    r624008 r634634  
    2525  this.user_id = null;
    2626  this.query = null;
     27  this.sort_by = null;
    2728  this.photoset_id = null;
    2829
     
    203204      }
    204205      this.query = $('#flickr_search_query').val();
     206      this.sort_by = $('#sort_by').val();
    205207    }else{
    206208      this.page += paging;
     
    215217  this.flickrPhotoSearch = function(params) {
    216218    params.per_page = 18;
    217     params.sort     = 'date-posted-desc';
     219    params.sort     = this.sort_by;
    218220    params.format   = 'json';
    219221    params.jsoncallback = 'wpFlickrEmbed.callbackSearchPhotos';
  • wp-flickr-embed/trunk/wp-flickr-embed.php

    r624008 r634634  
    322322        color: #888;
    323323    }
     324    #search-filter  {
     325        text-align: left;
     326    }
     327    #search-filter .extra_filters {
     328        margin: 5px 0;
     329    }
    324330    h3 {
    325331        padding-top: 10px;
     
    343349    <input type="hidden" name="type" value="<?php echo $type ?>" />
    344350    <input type="hidden" name="tab" value="<?php echo $tab ?>" />
    345     <div id="search-filter">
     351    <div id="search-filter" style="text-align: left">
    346352        <?php _e('Search:', 'wp-flickr-embed') ?>
    347353        <input type="text" id="flickr_search_query" />
    348         <?php if(!empty($wpFlickrEmbed->settings['username'])) { ?>
    349         <select id="photoset" name="photoset">
    350         </select>
     354        <?php if(!empty($wpFlickrEmbed->settings['username'])): ?>
     355        <select id="photoset" name="photoset"></select>
    351356        <input type="radio" id="flickr_search_0" name="flickr_search" class="searchTypes" value="own" checked="checked"/><label for="flickr_search_0"><?php _e('Your Photos', 'wp-flickr-embed') ?></label>
    352357        <input type="radio" id="flickr_search_1" name="flickr_search" class="searchTypes" value="sets"/><label for="flickr_search_1"><?php _e('Your Sets', 'wp-flickr-embed') ?></label>
    353358        <input type="radio" id="flickr_search_2" name="flickr_search" class="searchTypes" value="everyone"/><label for="flickr_search_2"><?php _e('Everyone\'s Photos', 'wp-flickr-embed') ?></label>
    354         <?php } ?>
     359        <?php endif; ?>
    355360        <input type="submit" onclick="wpFlickrEmbed.searchPhoto(0)" value="<?php _e('Search photo', 'wp-flickr-embed'); ?>" class="button" />
     361        <div class="extra_filters">
     362            <label for="sort_by">Sort by:</label>
     363            <select id="sort_by">
     364                <option value="date-posted-desc">Date posted (desc)</option>
     365                <option value="date-posted-asc">Date posted (asc)</option>
     366                <option value="date-taken-desc">Date taken (desc)</option>
     367                <option value="date-taken-asc">Date taken (asc)</option>
     368            </select>
     369        </div>
    356370    </div>
    357371    <h3><?php _e('Flickr photos', 'wp-flickr-embed') ?><span id="pages"></span></h3>
Note: See TracChangeset for help on using the changeset viewer.