-
-
Save dimsemenov/ba17b5f94642c12370e5f7f7d7781c27 to your computer and use it in GitHub Desktop.
This file contains 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 | |
// Creates [fire_royalslider id="YOUR_SLIDER_ID"] | |
// Add to your theme functions.php | |
function fire_royalslider_func($atts){ | |
$sliderid = $atts['id']; | |
$out = ''; | |
if (!$sliderid) { | |
return $out; | |
} | |
$out .= get_new_royalslider($sliderid); | |
// Init code | |
include_once(ABSPATH.'wp-content/plugins/new-royalslider/classes/NewRoyalSliderMain.php'); | |
$init_codes = NewRoyalSliderMain::$sliders_init_code; | |
if ( is_array($init_codes) && isset($init_codes[$sliderid]) ) { | |
$out .= '<script>'; | |
$out .= "jQuery(document).ready(function($) {\n"; | |
$out .= $init_codes[$sliderid]; | |
$out .= "});\n"; | |
$out .= '</script>'; | |
} | |
return $out; | |
} | |
add_shortcode('fire_royalslider', 'fire_royalslider_func'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment