Smart WYSIWYG Blocks Of Content
Problem with wp_enqueue_script in shortcode (1 post)

  1. valx76
    Posted 4 years ago #


    I need your help for a problem with this plugin..
    I'm developping plugins and I have problems to include styles/scripts with Smart Blocks..
    In the Smartblock content, I include a shortcode ([carrousel] for example), that called external JS / CSS files. They work in a simple page but not inside a Smart Block..

    To includes styles, I'm using that way :

    add_action( 'wp_print_styles', 'vp_annuaire_css' );
    function vp_annuaire_css() {
    	if ( !is_admin() ) {
    		global $posts;
    		if ( $posts != NULL ) {
    			foreach( $posts as $post ) {
    				if ( strstr( $post->post_content, '[carrousel' ) ) {
    					wp_enqueue_style( 'annuaire_css', plugins_url( 'css/annuaire.css', __FILE__ ) );

    The problem is that the global variable $posts doesn't contain Smart Blocks posts..

    EDIT: I'm using the 0.6 version.

    Best regards,


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Smart WYSIWYG Blocks Of Content
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic