Topic: MDB Bootstrap Integration with WordPress

simplelife free asked 6 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() . '/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' );

andras.ori pro answered 6 years ago


Same problem for me too. Screenshot from consol:

Mikołaj Smoleński staff commented 6 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

Mikołaj Smoleński staff answered 6 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

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

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags