-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwpvideofloater.php
More file actions
35 lines (30 loc) · 979 Bytes
/
wpvideofloater.php
File metadata and controls
35 lines (30 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
* Plugin Name: WP Video Floater
* Plugin URI: https://wpgate.com.br
* Description: This plugin will allow you to keep your videos playing floating at the bottom of the page as you scroll down
* Version: 1.0
* Author: Tiago Rodrigues
* Author URI: http://wpgate.com.br
* License: GPL2
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function wpvf_register(){
wp_register_script( 'modernizr', plugins_url('/js/modernizr.js', __FILE__), array(), '2.7.1');
wp_enqueue_style( 'wpvf-styles', plugins_url('/css/wpvf-styles.css', __FILE__), array(), '0.1');
}
add_action('wp_enqueue_scripts', 'wpvf_register');
function wpvf_find_shortcode()
{
global $post;
global $content;
$content = $post->post_content;
if ( ! is_admin() ) {
if( has_shortcode( $content, 'wp-video-floater' ) ) {
wp_enqueue_script( 'wpvfjs', plugins_url('/js/wpvf.js', __FILE__), array( 'modernizr', 'jquery' ), '0.1');
}
}
}
add_shortcode('wp-video-floater', 'wpvf_find_shortcode');