public function glmMembersShortcode(){
- // load shortcodeBuilder.js when the shortcode function has been fired
- add_action('admin_print_styles-post.php', 'custom_js_css');
- add_action('admin_print_styles-post-new.php', 'custom_js_css');
+ // load shortcodeBuilder.js when the shortcode function has been fired if it hasn't been enqueued yet
+ if( ! wp_script_is( 'jquery-ui-dialog', 'enqueued' ) ){
+ wp_enqueue_script('jquery-ui-dialog', false, array('jquery'), false, true);
+ wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css');
+ }
function custom_js_css() {
wp_enqueue_script('your-meta-box', GLM_MEMBERS_PLUGIN_URL. '/js/shortcodeBuilder.js', array('jquery'), null, true);
}
+ add_action('admin_print_styles-post.php', 'custom_js_css');
+ add_action('admin_print_styles-post-new.php', 'custom_js_css');
reset($this->config['addOns']);
foreach ($this->config['addOns'] as $a) {
$cssFile = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.$a['slug'].'/css/admin.css';
$("#shortcodeDropdown").on("change", function () {
// reset the dropdowns and checkbox if when switching shortcodes
document.getElementById('category-scDropdown').options[0].selected = 'selected';
- document.getElementById('blank-start-scDropdown').options[0].selected = 'selected';
- if(document.getElementById('id-scDropdown').length > 0)
+ if($('#blank-start-scDropdown').length)
+ document.getElementById('blank-start-scDropdown').options[0].selected = 'selected';
+ if($('#id-scDropdown').length)
document.getElementById('id-scDropdown').options[0].selected = 'selected';
UncheckAll();