Create a gist now

Instantly share code, notes, and snippets.

@dimsemenov /1.php Secret
Created May 15, 2018

What would you like to do?
<?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