How do I add Bootstrap and LESS to my migrated WordPress site?

You don’t need to create additional functions, just re-use what you already have and tweak it a bit: function theme_add_bootstrap() { wp_enqueue_style( ‘bootstrap-css’, get_template_directory_uri() . ‘/third_party/bootstrap/css/bootstrap.min.css’ ); wp_enqueue_script( ‘bootstrap-js’, get_template_directory_uri() . ‘/third_party/bootstrap/js/bootstrap.min.js’, array(), ‘3.0.0’, true ); if (WP_ENV === ‘development’) { wp_enqueue_script( ‘lesscss’, get_stylesheet_directory_uri() . ‘/third_party/less-1.5.0.min.js’ ); wp_enqueue_style( ‘style-less’, get_template_directory_uri() . ‘/css/custom.less’ ); } else … Read more

Enqueueing a script and a style sheet not working

In the context of parent – child themes, be aware that: The get_template_directory_uri() will give you the parent theme directory uri: https://codex.wordpress.org/Function_Reference/get_template_directory_uri. The get_stylesheet_directory_uri() will give you the child theme directory uri: https://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri You are enqueueing parent-style with get_stylesheet_directory_uri(), which will give you the child theme directory uri. You are enqueueing child-css and child-js using … Read more

What is the proper way to include Bootstrap when executing a shortcode

I also find the typical practice of queuing globally or from inside shortcodes problematic. I had a similar challenge with implementing code highlight on my site — I only wanted scripts and style to load as necessary. I ended up checking content for <pre> tag as condition to output: {% if ‘<pre>’ in get_the_content() %} … Read more

Multiple WordPress Menus that will only display all pages

The keys for the array passed to register_nav_menus() should correspond with the ‘theme_location’ arguments in your calls to wp_nav_menu(). Since they do not, WordPress is unable to locate the appropriate menu and displays a default consisting of all top-level pages instead. Either change your ‘theme_location’ arguments to ‘menu-1’ and ‘menu-2’ or change the array keys … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)