jQuery(function($){
$(document).ready(function(){
$( ".office-accordion" ).accordion({heightStyle: "content"});
});
});
function custom_shortcode_scripts() {
global $post;
if( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'custom-shortcode') ) {
wp_enqueue_script( 'custom-script');
}
}
add_action( 'wp_enqueue_scripts', 'custom_shortcode_scripts');
jQuery(function($){
$(document).ready(function(){
function test(){
if( ! $( ".office-accordion" ).length ) return false;
$( ".office-accordion" ).accordion({heightStyle: "content"});
}
test();
});
});
function has_shortcode_func($atts){
$xhtml = '<script type="text/javascript"> jQuery(function($){
jQuery(document).ready(function(){
jQuery( ".office-accordion" ).accordion({heightStyle: "content"});
}); });</script>';
return $xhtml;
}
add_shortcode('has_shortcode', 'has_shortcode_func');
[has_shortcode]