Wordpress

How to add Bootstrapp in WordPress CSS and Js

You can easily use Bootstrap in your wordpress website, by adding the snippet bellow. With that code, we link the Bootstrap CSS and Javascript files to your wordpress website, so

    
function add_bootstrap_to_header() { echo '<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> <link rel="preload" href="/assets/bootstrap/css/bootstrap.min.css" as="style" />'; } add_action( 'wp_head', 'add_bootstrap_to_header' ); function add_bootstrap_to_footer() { echo ' <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>'; } add_action( 'wp_footer', 'add_bootstrap_to_footer' );

Leave a Reply

Your email address will not be published. Required fields are marked *