Created
April 27, 2017 13:50
-
-
Save salmancreation/db5849bd6c0c3d86fed6f12410f98fef to your computer and use it in GitHub Desktop.
CountUp Shortcode.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! defined( 'ABSPATH' ) ) { exit; } | |
function factorian_countUp_box_shortcode($atts){ | |
extract( shortcode_atts( array( | |
'countup_title' => '', | |
'countup_icon' => '', | |
'countup_icon_color' => '', | |
'countup_numbers' => '', | |
'countup_delay' => '', | |
'countup_speed' => '', | |
'countup_box_background' => '', | |
'countup_title_color' => '', | |
), $atts) ); | |
$rand_val = rand(); | |
$factorian_countUp_box =' | |
<script type="text/javascript"> | |
jQuery(document).ready(function($){ | |
$(".counter'.$rand_val.'").counterUp({ | |
delay: '.$countTo_delay.', | |
time: '.$countTo_speed.' | |
}); | |
}); | |
</script> | |
<div class="single_countTo_item" style="background-color:'.$countup_box_background.';" > | |
<div class="countup_item_icon"><i style="color:'.$countup_icon_color.';" class="'.$countup_icon.'"></i></div>'; | |
$factorian_countUp_box .='<span class="counter'.$rand_val.'">'.$countup_numbers.'</span>'; | |
$factorian_countUp_box .='<h4 style="color:'.$countup_title_color.';" >'.$countup_title.'</h4> | |
</div>'; | |
return $factorian_countUp_box; | |
} | |
add_shortcode('factorian_countup_box', 'factorian_countUp_box_shortcode'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment