I'm working with wordpress and I put this code, but in F12 doesn't show errors.
I put the carrousel to test and continue not working.
I try to put scripts in after footer too but not working too.
CSS is working, just js not working.
Please, could you help me?
<?php
/**
* Include CSS files
*/
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-2.2.3.min.js', array(), '2.2.3', true );
wp_enqueue_script( 'Tether', get_template_directory_uri() . '/js/tether.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'Bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'MDB', get_template_directory_uri() . '/js/mdb.min.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_scripts' );
?>
Suellyn
Please can you check if solution provided by teawebsite is working for you ?? It looks like there is some issue with scripts linking. If this won't resolve your problem please contact me on m.szuchta@mdbootstrap.com.
This is what is working for me:
1- first of all you have to work always with child theme: if you do something wrong or update core theme you don't lose your work.
2- in child theme create a folder (e.g: assets).
3- in assets put all mdb pro files.
4- because WP has its own copy of jquery first deregister jquery and then register your preferred version.
5- in functions.php link all css and js using get_stylesheet_directory_uri() because you are working with child theme.
/******* DEREGISTER / REGISTER JQUERY *******/
function my_init()
{
if (!is_admin())
{
wp_deregister_script('jquery');
wp_register_script('jquery', get_stylesheet_directory_uri() . '/assets/js/jquery-3.1.1.min.js', FALSE, '3.1.1', FALSE);
wp_enqueue_script('jquery');
}
}
add_action('init', 'my_init');
/******* ENQUEUE CSS / JS *******/
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
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_stylesheet_directory_uri() . '/assets/css/bootstrap.css' );
wp_enqueue_style( 'MDB', get_stylesheet_directory_uri() . '/assets/css/mdb.min.css' );
wp_enqueue_style( 'Style', get_stylesheet_directory_uri() . '/style.css' ); // your own style
wp_enqueue_script( 'Tether', get_stylesheet_directory_uri() . '/assets/js/tether.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'Bootstrap', get_stylesheet_directory_uri() . '/assets/js/bootstrap.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'MDB', get_stylesheet_directory_uri() . '/assets/js/mdb.min.js', array(), '1.0.0', true );
}
6- Bonus trick : add this in functions.php to avoid WP adding <p> tag in blank space (lightbox not works without those functions)
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );
Note: all MDB PRO 4.3.2 styles and functions I've tried are working except parallax css
Hope this helps.
Hello Maciej!
How are you?
Thank for your answer, but I tried to clear web browser cash memory and refresh it (Google chrome ctrl + F5 ) and use code with false, but not working yet.
:(
Js is not being called also when I use F12 (Network) to inspect.
Hello Suellyn
Your function looks correct so in this case first solution that might help is to clear web browser cash memory and refresh it (Google chrome ctrl + F5 ).
Another solution that might work would be to change versions of attached scripts to boolean value 'false'. So function would look like this: