mardi 2 septembre 2014

adding css to wordpress when shortcode is used


Vote count:

0




I can't seem to get this function to work and was wondering if someone could take a look for me.


I have some static pages that use a special form, I don't want/need the css loaded on every page of the site though.




function skyform_check_function() {
global $post
if (has_shortcode( $post->post_content, 'skyform_function')) {
wp_enqueue_script( 'add_skyform_css_function');
}
}
add_action ('wp_enqueue_scripts', 'skyform_check_function');



[skyform_function] is the shortcode for the form function add_skyform_css_function() adds the css. <- this work fine if I just do add_action ('wp_head', 'add_skyform_css_function');



asked 42 secs ago







adding css to wordpress when shortcode is used

Aucun commentaire:

Enregistrer un commentaire