-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathodometer.php
More file actions
29 lines (28 loc) · 1.13 KB
/
Copy pathodometer.php
File metadata and controls
29 lines (28 loc) · 1.13 KB
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
<?php
/**
* Plugin Name: Odometer
* Plugin URI: http://jns.design
* Description: This plugin adds Odometer by HubSpot.
* Version: 1.0.0
* Author: Matt Sobieray
* Author URI: http://hyfyn.com
* License: GPL2
*/
add_shortcode('odometer', 'odometer_shortcode');
add_action('wp_enqueue_scripts', 'odometer_scripts');
function odometer_scripts() {
$url = plugin_dir_url( __FILE__ );
wp_enqueue_style('odometer-default', $url . 'odometer-theme-default.css', array(), null, false );
wp_enqueue_style('odometer-custom', $url . 'custom.css', array(), null, false );
wp_enqueue_script( 'odometer-js', $url . 'odometer.min.js', array(), null, false );
wp_enqueue_script('odometer-init', $url . 'odometer-init.js', array(), null, true );
}
function odometer_shortcode($atts) {
$a = shortcode_atts( array(
'start_number' => '0',
'finish_number' => '15',
'text' => 'the text'
), $atts );
return '<div class="hero_content odometer-container"><div class="border-right"><div class="odometer" data-end="'.esc_attr($a['finish_number']).'">'. esc_attr($a['start_number']) .'</div><p>'. esc_attr($a['text']) .'</p></div></div>';
}
?>