tags * * NOTE: This will affect ALL content on site, and may have undesirable consequences * Therefore it's commented out by default. Test before using. * * */ // remove_filter ('the_content', 'wpautop'); /* * * load styles and scripts to head * */ function ableplayer_enqueue_scripts(){ // Documentation: // http://codex.wordpress.org/Function_Reference/wp_enqueue_script // Register/enqueue common scripts that can be called automatically with just their handles (as of WP 3.5) wp_enqueue_script( 'jquery' ); // Register/enqueue other dependencies wp_enqueue_script( 'js-cookie', plugins_url('thirdparty',__FILE__).'/js.cookie.js',array('jquery')); wp_enqueue_script( 'vimeo', 'https://player.vimeo.com/api/player.js' ); // Register/enqueue Able Player JavaScript (two options; uncomment the one you prefer) // JS Option 1: minified, for production wp_enqueue_script( 'ableplayer', plugins_url('build',__FILE__).'/ableplayer.min.js',array('jquery')); // JS Option 2: human-readable, for debugging // wp_enqueue_script( 'ableplayer', plugins_url('build',__FILE__).'/ableplayer.js',array('jquery')); // Register/enqueue Able Player CSS (two options; uncomment the one you prefer) // CSS Option 1: minified, for production wp_enqueue_style( 'ableplayer', plugins_url('build',__FILE__).'/ableplayer.min.css'); // CSS Option 2: human-readable; use this if you intend to change the styles and customize the player // wp_enqueue_style( 'ableplayer', plugins_url('styles',__FILE__).'/ableplayer.css'); } add_action( 'wp_enqueue_scripts', 'ableplayer_enqueue_scripts'); /* * * Add support for [ableplayer] shortcode * * */ function ableplayer_shortcode( $atts,$content=null ) { // Each of the following attributes can be passed with the [ableplayer] shortcode // 'id' and 'type' (video or audio) is required // normalize attribute keys, lowercase $atts = array_change_key_case((array)$atts, CASE_LOWER); // build complete array of all attributes; defaults will be overridden with user values $all_atts = shortcode_atts([ 'id' => ableplayer_get_unique_id(), 'youtube-id' => '', 'youtube-desc-id' => '', 'youtube-nocookie' => '', 'vimeo-id' => '', 'vimeo-desc-id' => '', 'autoplay' => 'false', 'preload' => 'auto', 'loop' => 'false', 'playsinline' => 'true', 'hidecontrols' => 'false', 'poster' => '', 'width' => '', 'height' => '', 'heading' => '', 'speed' => 'animals', 'start' => '', 'volume' => '', 'seekinterval' => '', 'nowplaying' => 'false', 'skin' => '2020' ], $atts ); // output if (!($all_atts['youtube-id'] || $all_atts['vimeo-id'])) { // required fields are missing return false; } else { // build a video player! $o = '