Skip to content

Instantly share code, notes, and snippets.

@dimsemenov
Created June 16, 2015 17:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimsemenov/0e46da0a88454fc04e95 to your computer and use it in GitHub Desktop.
Save dimsemenov/0e46da0a88454fc04e95 to your computer and use it in GitHub Desktop.
function fire_royalslider_func($atts){
$sliderid = $atts['id'];
$out = '';
if (!$sliderid) return;
/* Print slider HTML, skip this part if you already have it on page */
$out .= get_new_royalslider($sliderid);
/* Print slider END */
// Init code
include_once(ABSPATH.'wp-content/plugins/new-royalslider/classes/NewRoyalSliderMain.php');
$init_codes = NewRoyalSliderMain::$sliders_init_code;
if(count($init_codes) > 0 ) {
$out .= '<script>';
$out .= "jQuery(document).ready(function($) {\n";
foreach($init_codes as $key => $value) {
$out .= $value;
}
$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