MDB Bootstrap Integration with WordPress


Topic: MDB Bootstrap Integration with WordPress

simplelife asked 7 years ago

I built many Wordpress themes in the past, but now try using MDB Bootstrap to build a new theme.

Am unable to get Bootstrap JS files working correctly with Wordpress.

Using Chrome's developer console, I get the following errors:

bootstrap.min.js?ver=4.9.2:6 Uncaught TypeError: Cannot read property 'fn' of undefined
 at bootstrap.min.js?ver=4.9.2:6
 at bootstrap.min.js?ver=4.9.2:6
 at bootstrap.min.js?ver=4.9.2:6
(anonymous) @ bootstrap.min.js?ver=4.9.2:6
(anonymous) @ bootstrap.min.js?ver=4.9.2:6
(anonymous) @ bootstrap.min.js?ver=4.9.2:6
mdb.min.js?ver=4.9.2:7 Uncaught TypeError: $ is not a function
 at mdb.min.js?ver=4.9.2:7

I read elsewhere that there is a bug with Bootstrap 4 on Wordpress? Does anyone have any insight or remedy?

I implement the Bootstrap css and js in my Wordpress funtions.php

function theme_enqueue_scripts() {
 wp_enqueue_style( 'Font_Awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css' );
 wp_enqueue_style( 'Bootstrap_css', get_template_directory_uri() . '/css/bootstrap.min.css' );
 wp_enqueue_style( 'MDB', get_template_directory_uri() . '/css/mdb.min.css' );
 wp_enqueue_style( 'Style', get_template_directory_uri() . 'https://mdbcdn.b-cdn.net/style.css' );
 wp_enqueue_script( 'jQuery', get_template_directory_uri() . '/js/jquery-3.2.1.min.js', array(), '3.2.1', true );
 wp_enqueue_script( 'Popper', get_template_directory_uri() . '/js/popper.min.js', array('jquery'));
 wp_enqueue_script( 'Bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'));
 wp_enqueue_script( 'MDB', get_template_directory_uri() . '/js/mdb.min.js', array('jquery'));
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_scripts' );

Mikołaj Smoleński staff answered 7 years ago

Hello, Please check out the following article and try to add everything as in the instruction: https://www.zenwebthemes.com/blog/how-to-add-bootstrap-to-your-wordpress-theme/ Adding MDB scripts should be similiar to adding Bootstrap files. Regards

andras.ori pro answered 7 years ago

Same problem for me too. Screenshot from consol:

Mikołaj Smoleński staff commented 7 years ago

Are You sure that jquery script is also in the right folder? It seems like bootstrap is not working becouse the other scripts are not loading correctly. Regards

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No