Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress From Bootstrap to WordPress Add Bootstrap Components to WordPress Theme How to Add Bootstrap Modal Windows to Your WordPress Theme

Diego Palma
Diego Palma
12,653 Points

As soon as I click on the contact button, the MODAL fades in and then immediately disappears.

Browsing online I found that this is typical behavior for loading the Modal plugin JavaScript twice.

So this is what I did: I went to the functions.php and in the add_action function I replaced the handle theme_js for bootstrap_js (see code below). This fixed the problem but now I'm confused... Any ideas?

wp_enqueue_script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true );

wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery', 'bootstrap_js'), '', true );

} add_action( 'wp_enqueue_scripts', 'bootstrap_js' );

David Richied
David Richied
18,057 Points

Thanks to the helpful comment of Josh Miclette (https://teamtreehouse.com/community/carousel-slider-works-but-the-images-do-not-slide), I was able to find a solution.

Go to Settings>BS Shortcodes and uncheck the boxes that say Load Twitter Bootstrap css file and Load Twitter Bootstrap javascript file

Now, you'll also have to go back and change your theme_js function back to normal (I would just download the project folder and replace everything from your functions.php file with the contents of the functions.php file in the project downloads folder). Hope this works!

8 Answers

Settings>BS Shortcodes uncheck the boxes Load Twitter Bootstrap css file and Load Twitter Bootstrap javascript. BS Shortcodes plugin loads the bootstrap css & js on it own and it the tut you are loading it too.

David McGaa
David McGaa
2,759 Points

Just to add Stack Overflow. Appears to be caused by loading the Bootstrap framework multiple times (once in the functions.php and once in the Bootstrap shortcodes plugin), adding two listeners to the same button.

Need to use one or the other, not both.

I did what Viktor and David said, and now it works fine for me! Thanks so much guys!

Diego Palma
Diego Palma
12,653 Points

Thank you Viktor, that worked for me/

Thank you Vitor :)

Danka Kareen Shank
Danka Kareen Shank
6,978 Points

Thank you Viktor, it's work for me

This worked for me:

<?php if( function_exists( 'ninja_forms_display_form' ) ){ Ninja_Forms()->display( 1 ); } ?>

Just had this issue as well. Thanks for the heads up! :-)

Doris Keller
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Doris Keller
Front End Web Development Techdegree Graduate 47,926 Points

I had the same problem and I tried with the unchecked css and js-files, but as a result it didn't took consideration of the right css anymore - then I unchecked only the bootstrap-js-file and now it works. Thank you very much!