Skip Navigation

[Resolved] How to load bootstrap only in a specific page

This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by Benoît 6 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#531783

I am trying to: load Bootstrap 3 only in my homepage because I need it for the view slider but not in the other pages. (especially that it causes other visual bug in the theme).
Is there an option to load with condition?

thanks

#531879

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I would like to know your bootstrap load settings, from where you are loading the bootstrap - theme or plugin?

#531881

I load it from toolset settings because my theme is not made with bootstrap.

thanks

#531883

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok - there is no way to restrict the bootstrap if you set to load bootstrap from Toolset plugins.

Better - do not load bootstrap from Toolset and try to add bootstrap manually on your homepage.

Something like this - add following code to functions.php file of your theme:

function homepage_add_bootsrap() {
if ( is_front_page() ) {	
    wp_enqueue_style('bootstrap', get_template_directory_uri() . 'css/bootstrap.min.css');
    wp_enqueue_style('style', get_stylesheet_uri());
    wp_enqueue_script( 'bootstrap-js', '<em><u>hidden link</u></em>', array('jquery'), '3.3.4', true );
    }
}
add_action('wp_enqueue_scripts', 'homepage_add_bootsrap');

More info:
=> https://stackoverflow.com/questions/26583978/how-to-load-bootstrap-script-and-style-in-functions-php-wordpress
=> https://stackoverflow.com/questions/26583978/how-to-load-bootstrap-script-and-style-in-functions-php-wordpress

#533123

thanks!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.