Plugin Directory

Changeset 687400


Ignore:
Timestamp:
03/26/2013 08:22:16 AM (13 years ago)
Author:
wp-maverick
Message:

Code improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-fading-content-slider/trunk/wp-fading-content-slider.php

    r669898 r687400  
    44 * Plugin URI: http://www.mba-multimedia.com/en/innovation/wordpress/plugins/wp-fading-content-slider/
    55 * Description: A customizable JQuery content slider with CSS3 animations and fading effects
    6  * Version: 0.2.1
     6 * Version: 0.2.2
    77 * Author: MBA Multimedia
    88 * Author URI: http://www.mba-multimedia.com/
     
    194194    }
    195195
     196    function get_wp_generated_thumb( $thumb ) {
     197        $thumb = explode("\"", $thumb);
     198        return $thumb[5];
     199    }
     200
    196201    /**
    197202     * Show the slider to the front-end
     
    236241
    237242        $args = array( 'meta_key' => 'fading_slider',
    238                 'meta_value'=> '1',
     243                'meta_value'=> '1', // Seulement les objets dont la case est cochée dans le back
    239244                'suppress_filters' => 0,
    240245                'post_type' => array('post', 'page'),
    241246                'orderby' => $sort,
    242247                'order' => 'DESC',  // DESC = Show last post first
    243                 'numberposts'=> 4);     // HTML Markup only allows 4 slides
    244 
    245         global $myposts;
     248                'numberposts'=> 4); // HTML Markup only allows 4 slides
     249
    246250        $myposts = get_posts( $args );
    247251
    248252        if (function_exists('add_image_size')) {
    249             //add_image_size( 'fading_slider', $img_width, $img_height, true );
    250253            add_image_size( 'fading_slider', $img_width, $img_height, true ); // Miniatures des archives
    251254        }
    252255
    253         function get_wp_generated_thumb($position) {
    254             $thumb = get_the_post_thumbnail($post_id, $position);
    255             $thumb = explode("\"", $thumb);
    256             return $thumb[5];
    257         }
    258 
    259256        /* PHP Generated Styles here */
    260 
    261257        ?>
    262 
    263258        <style type="text/css">
    264259
     
    268263                width: <?php $width = get_option('fading_slider_width'); if(!empty($width)) {echo $width;} else {echo "580";}?>px;
    269264            }
    270 
    271265        <?php
    272266
     
    275269
    276270                $custom = get_post_custom($post->ID);
    277                 $thumb = get_wp_generated_thumb("fading_slider");
     271                echo "/* ID POST : " . $post->ID . "*/";
     272                $thumb = $this->get_wp_generated_thumb( get_the_post_thumbnail( $post->ID ) );
     273                // $thumb = $this->get_wp_generated_thumb( get_the_post_thumbnail($post->ID, "fading_slider") );
    278274
    279275                echo ".cr-container input.cr-selector-img-".$i.":checked ~ .cr-bgimg,
     
    284280                $i++;
    285281            endforeach; wp_reset_postdata();
     282
    286283        ?>
    287284        </style>
     
    341338    foreach( $myposts as $post ) :  setup_postdata($post);
    342339
    343             $custom = get_post_custom($post->ID);
    344             $thumb = get_wp_generated_thumb("fading_slider");
     340            // $custom = get_post_custom($post->ID);
     341            $thumb = $this->get_wp_generated_thumb( get_the_post_thumbnail($post->ID, "fading_slider") );
    345342?>
    346343
     
    356353<?php
    357354    $i++;
    358     endforeach;
     355    endforeach; wp_reset_postdata();
    359356?>
    360357
Note: See TracChangeset for help on using the changeset viewer.