How Do I Add a Bootstrap CDN Link in WordPress?
Bootstrap is a popular front-end CSS and JavaScript library used by millions of web developers. It’s available as a CDN link, so you can load Bootstrap files from anywhere on the web.
To add a Bootstrap CDN link in WordPress, follow these steps:
1. Add the Bootstrap CDN link to your website.
Bootstrap’s CDN link can be found at https://cdn.bootstrap.
com/.
2. In your WordPress theme’s functions.php file, add the following code:
// Add the Bootstrap CDN link function add_bootstrap_cdn_link() { global $bootstrap_cdn; $bootstrap_cdn = ‘https://cdn.com/'; } add_action(‘init’, ‘add_bootstrap_cdn_link’);
3. Add the Bootstrap CDN link to your WordPress theme’s style.
css file.
Here’s an example of how to add the Bootstrap CDN link to your style.css file:
wp-content { margin: 0; padding: 0; } .wp-content-main { background: url(https://cdn.com/assets/css/bootstrap-3.3.7/bootstrap.min.css) no-repeat top center; } .
wp-content-footer { background: url(https://cdn.7/bootstrap-footer.css) no-repeat bottom center; }.
4. Add the Bootstrap CDN link to your WordPress theme’s JavaScript file.
Here’s an example of how to add the Bootstrap CDN link to your JavaScript file:
// Add the Bootstrap CDN link $(function(){ // Get the Bootstrap CDN link var bootstrap_cdn = ‘https://cdn.com/'; // Use the Bootstrap CDN link in your theme });
5. Add the Bootstrap CDN link to your WordPress theme’s stylesheet.
Here’s an example of how to add the Bootstrap CDN link to your stylesheet:
@import ‘https://cdn.com/css/bootstrap-3.
7/bootstrap.css';.