Skip to content

Instantly share code, notes, and snippets.

@dimsemenov

dimsemenov/1.php Secret

Created May 15, 2018 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimsemenov/ba17b5f94642c12370e5f7f7d7781c27 to your computer and use it in GitHub Desktop.
Save dimsemenov/ba17b5f94642c12370e5f7f7d7781c27 to your computer and use it in GitHub Desktop.
<?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