Plugin Directory

Changeset 1574937


Ignore:
Timestamp:
01/15/2017 01:51:18 AM (9 years ago)
Author:
blakelong
Message:

Updated shortcode to accept class and position attribute. Also added stylesheet

File:
1 edited

Legend:

Unmodified
Added
Removed
  • shrinking-video/trunk/class.shrinkingvideo.php

    r1565766 r1574937  
    66    function __construct(){
    77        add_action( 'wp_enqueue_scripts', array( $this, 'shrinking_video_scripts' ) );
     8        add_action( 'wp_enqueue_scripts', array( $this, 'shrinking_video_stylesheet' ) );
    89        add_shortcode( 'shrinkingvideo', array( $this, 'shrinking_video_shortcode' ) );
    910    }
     
    2021            'src' => '',
    2122            'height' => '394',
    22             'width' => '700'
     23            'width' => '700',
     24            'position' => 'top-right',
     25            'class' => ''
    2326        ), $atts );
    2427       
    2528        $new_url = wp_oembed_get( $a['src'], array( 'width' => $a['width'], 'height' => $a['height'] ) );
    26         echo "<script> shrinking_video({$a['height']},{$a['width']}); </script>";
     29        echo "<script> shrinking_video({$a['height']},{$a['width']},'{$a['position']}'); </script>";
    2730
    28         return "<div id='shrinking_video'>{$new_url}</div>";
     31        return "<div id='shrinking_video' class='{$a['class']}'>{$new_url}</div>";
    2932    }
    3033   
     
    3235        wp_enqueue_script( 'jquery' );
    3336        wp_enqueue_script( 'shrinkingvideo.js', plugin_dir_url( __FILE__ ) . 'js/shrinkingvideo.js' );
     37    }
     38   
     39    function shrinking_video_stylesheet(){
     40        wp_enqueue_style( 'shrinkingvideo.css', plugin_dir_url( __FILE__ ) . 'css/shrinkingvideo.css' );
    3441    }
    3542   
Note: See TracChangeset for help on using the changeset viewer.