• It’s great that the latest version of VFB now only loads the CSS and JS only on pages which have the form embedded, but this has caused a problem for me.

    Using my own page temple I pull the contents of some pages together into one page and, whilst the shortcode is being fired correctly and displays the HTML, because the page itself is not being displayed, the CSS and JS are not being injected into the wp_head() call.

    I know this is a fairly unusual way of doing things, but I’m sure it might cause others problems too. Therefore, would it be possible to have an option in the settings to “Always load CSS/JS”?

    Cheers

    Peter

    http://wordpress.org/plugins/visual-form-builder/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Matthew Muro

    (@mmuro)

    I can add an option for always loading the CSS, but the JS should load no matter what. It’s part of the shortcode function and should enqueue properly if you have wp_footer in your theme.

    I’m not really sure I understand what you are describing. Link?

    Thread Starter Peter Hardy-vanDoorn

    (@petervandoorn)

    Hi Matt.

    I’m not surprised that you’re a little confused, and I must confess that what I’m doing is a little odd, but it does throw up an interesting issue!

    Here’s the site in question: http://www.cjlarkin.com (I have added the CSS and JS links manually so that it’s working, btw).

    What you’re seeing is a single page site, but each of the concertina sections is actually a WP page, pulled in using a custom loop where post_type = “page” (pages, after all, are just posts!)

    The page that contains the form, New Applicants, has the shortcode in the content, and that is being called correctly. However, as the shortcode is not being called in the actual page, VFB obviously does not know to load the CSS and JS.

    I do have wp_head() and wp_footer() where they should be.

    I haven’t tried it, but I would imagine the same would happen if someone used the shortcode in a normal post. So, I was wondering, for awkward sods like me, if you could add a preference to make VFB always load the files like it used to to!

    Cheers

    Peter

    Plugin Author Matthew Muro

    (@mmuro)

    The setting is easy enough and is actually way more useful when using the Pro version (due to the template tag).

    Until that’s added to the free version, I suggest adding a proper enqueue to your theme’s functions.php (which will essentially load it everywhere).

    function my_scripts_method() {
    	wp_enqueue_style( 'visual-form-builder-css' );
    	wp_enqueue_style( 'vfb-jqueryui-css' );
    }
    
    add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘CSS & JS not loading’ is closed to new replies.