Plugin Directory

Changeset 687192


Ignore:
Timestamp:
03/25/2013 09:09:59 PM (13 years ago)
Author:
wp-maverick
Message:

Added a parameter to the shortcode to filter categories

Location:
wp-parallax-content-slider/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-parallax-content-slider/trunk/README.txt

    r685846 r687192  
    66Requires at least: 3.0
    77Tested up to: 3.5.1
    8 Stable tag: 0.9.3
     8Stable tag: trunk
    99
    1010A customizable JQuery content slider with CSS3 animations and parallax effects.
     
    2020It is very easy to configure the plugin as it adds automatically an admin page in Wordpress administration section. You will be able to configure :
    2121
    22 * New in v0.9.2 : The type of content to display (posts, pages, both);
     22* New in v0.9.4 : Filter category in a shortcode parameter (eg. [parallaxcontentslider cat="2"] or [parallaxcontentslider cat="2,5"]);
     23* The type of content to display (posts, pages, both);
    2324* The number of slides to display;
    2425* The auto-switch mode;
     
    3435* Add extra parameters to the admin panel (Sizes, colors,...);
    3536* Better touch support;
    36 * Enbale the choice to use featured images in the slides in dynamic mode;
     37* A new custom post type to manage static slides in the Wordpress admin panel
    3738* and many more...
    3839
     
    107108== Changelog ==
    108109
     110= 0.9.4 =
     111
     112* Support for a new shortcode parameter to filter on one or more categories
     113
    109114= 0.9.3 =
    110 
    111 Please don't forgive to backup your customized files and styles before doing an automatic update!
    112115
    113116* New translations (Georgian and Russian) thanks to Temur Danelia
     
    115118* Database optimization: Settings are added in the DB into an array instead of many fields (Old settings will be retrieved before deletion)
    116119* WPML support: Fixed post queries to improve WPML support
    117 
    118 Notice: This would be the last release before a great code refactoring! V1.0 should really rocks ;)
    119120
    120121= 0.9.2 =
  • wp-parallax-content-slider/trunk/wp-parallax-content-slider.php

    r685846 r687192  
    66 * Author URI: http://jltweb.info/
    77 * Author: Julien Le Thuaut (MBA Multimedia)
    8  * Version: 0.9.3
     8 * Version: 0.9.4
    99 * Licence: GPLv2
    1010*/
     
    125125
    126126    /**
    127      * Enable shortcode : [parallaxcontentslider]
     127     * Enable shortcodes :
     128     * [parallaxcontentslider]
     129     * [parallaxcontentslider cat="2"]
     130     * [parallaxcontentslider cat="2,5"]
    128131     */
    129132    public function parallaxcontentslider_shortcode_call( $atts ){
    130         get_wp_parallax_content_slider();
    131         // TODO: Add attributes to customize the slider?
     133        // Extracting parameters
     134        extract( shortcode_atts( array (
     135                                        'categ' => '',
     136                                       ), $atts ) );
     137       
     138        get_wp_parallax_content_slider( $categ );
    132139    }
    133140   
     
    135142     * Return the plugin HTML code for output
    136143     */
    137     public function get_parallax_content_slider()
     144    public function get_parallax_content_slider( $category = '' )
    138145    {
     146       
     147       
    139148        // Retrieving plugin parameters (user choices or default values)
    140149        $prlx_slider_settings = get_option( 'prlx_slider_settings');
     150       
    141151        $prlx_slider_mode               = $prlx_slider_settings['mode'];
    142152        $prlx_slider_theme              = $prlx_slider_settings['theme'];
     
    172182
    173183        $typ = '';
    174         switch ($prlx_slider_content_type) {
     184        switch ( $prlx_slider_content_type ) {
    175185            case "both":
    176186                $typ = array('post', 'page');
     
    184194
    185195        $cat = '';
    186         if ($prlx_slider_category_filter)
     196        if ( ! empty( $category ) )
     197        {
     198            // Mode is forced to 'dynamic'
     199            $prlx_slider_mode = 'dynamic';
     200            // Get category filter from shortcode attribute (i.e. function 'category' parameter)
     201            $cat = $category;
     202        }
     203        elseif ($prlx_slider_category_filter)
    187204        {
    188205            $cat = $prlx_slider_categories;
     
    192209                       'orderby' => $prlx_sort,
    193210                       'order' => $prlx_order,
    194                        'numberposts' =>  $prlx_slider_nb_articles,
    195                        'cat' => $cat,
    196                        'suppress_filters'=>0 ); // Added for WPML support
     211                       'numberposts' => $prlx_slider_nb_articles,
     212                       'category' => $cat,
     213                       'suppress_filters' => 0 ); // Added for WPML support
    197214
    198215        $myposts = get_posts( $args );
     
    202219
    203220        // TODO: remove this code in production mode
    204         //echo $debug  = "prlx_slider_content_type : " . $prlx_slider_content_type . "<br/>";
     221        echo $debug  = "cat : " . $cat . " | " . $category . "<br/>";
    205222
    206223        $outputDynamic = "<div id='da-slider' class='da-slider'>\n";
     
    688705$wp_parallax_content_slider = new WpParallaxContentSlider();
    689706
    690 function get_wp_parallax_content_slider()
     707function get_wp_parallax_content_slider( $cat_filter = '' )
    691708{
    692709    global $wp_parallax_content_slider;
    693     echo $wp_parallax_content_slider->get_parallax_content_slider();
     710    echo $wp_parallax_content_slider->get_parallax_content_slider( $cat_filter );
    694711}
    695712
Note: See TracChangeset for help on using the changeset viewer.