Title: Enqueue code for child theme
Last modified: March 30, 2021

---

# Enqueue code for child theme

 *  [The Travel Bunny](https://wordpress.org/support/users/mirelaiepurela/)
 * (@mirelaiepurela)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/enqueue-code-for-child-theme/)
 * Hi,
 * I don’t think I am using the right code in functions.php. I saw that the one 
   you have on your documentation site is completely blank and I want it to use 
   what the parent theme has and add/make replacements into the code with whatever
   I do.
 * My code on functions.php in the child theme currently begins like this:
    `<?php
   add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' ); function enqueue_parent_styles(){
   wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css', 
   array('bootstrap') );}`
 * This is what I used before moving to generatepress & worked. But I have the impression
   that at this time it isn’t, because some other things I did don’t show the expected
   results on the frontend. And I’m wondering if this is why.
 * Thanks.
    -  This topic was modified 5 years, 1 month ago by [The Travel Bunny](https://wordpress.org/support/users/mirelaiepurela/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fenqueue-code-for-child-theme%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Leo](https://wordpress.org/support/users/leohsiang/)
 * (@leohsiang)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/enqueue-code-for-child-theme/#post-14255253)
 * Hi there,
 * I would recommend starting from scratch with our child theme:
    [https://docs.generatepress.com/article/using-child-theme/](https://docs.generatepress.com/article/using-child-theme/)
 * I believe the code you’ve shown above is importing Bootstrap which isn’t needed
   to use with GeneratePress.
 *  Thread Starter [The Travel Bunny](https://wordpress.org/support/users/mirelaiepurela/)
 * (@mirelaiepurela)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/enqueue-code-for-child-theme/#post-14257841)
 * Hi Leo,
 * I downloaded your child theme, but the functions.php is empty… I need the right
   enqueue code… I actually wrote that above, but I think you overlooked some parts
   of my message.
    -  This reply was modified 5 years, 1 month ago by [The Travel Bunny](https://wordpress.org/support/users/mirelaiepurela/).
 *  [Leo](https://wordpress.org/support/users/leohsiang/)
 * (@leohsiang)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/enqueue-code-for-child-theme/#post-14260564)
 * Not sure if I fully understand.
 * The `function.php` is empty by default as you don’t actually need anything in
   there.
 * Perhaps this would help?
    [https://docs.generatepress.com/article/child-theme-issues/#enqueing-the-parent-style-css-file](https://docs.generatepress.com/article/child-theme-issues/#enqueing-the-parent-style-css-file)
 * I would recommend not importing Bootstrap with GeneratePress as you will encounter
   some issues.
 * Maybe your previous theme did but GP does not need Bootstrap to work.
 *  [mistifi](https://wordpress.org/support/users/mistifi/)
 * (@mistifi)
 * [5 years ago](https://wordpress.org/support/topic/enqueue-code-for-child-theme/#post-14415896)
 * I have that same problem. There is a serious issue with the enqueue code in GeneratePress.
   I have tested any possible variations so far and it still don’t work. Ok, we 
   are not supposed to use bootstrap but what if we need it ?
    -  This reply was modified 5 years ago by [mistifi](https://wordpress.org/support/users/mistifi/).
 *  [mistifi](https://wordpress.org/support/users/mistifi/)
 * (@mistifi)
 * [5 years ago](https://wordpress.org/support/topic/enqueue-code-for-child-theme/#post-14415963)
 * I found the correct enqueue code combination is :
 *     ```
       function my_bootstrap() {
           wp_enqueue_style( 'bootstrap', get_stylesheet_directory_uri() . '/assets/css/bootstrap.css' );
           wp_enqueue_script( 'bootstrap', get_stylesheet_directory_uri() . '/assets/js/bootstrap.js' );
       }
       add_action('wp_enqueue_scripts','my_bootstrap');
       ```
   
 * Which will be read in your code page like this :
    <link rel=’stylesheet’ id=’
   bootstrap-css’ href=’[http://[my-website]/wp-content/themes/%5Bmy-website-child-theme%5D/assets/css/bootstrap.css?ver=5.7.1&#8242](http://[my-website]/wp-content/themes/%5Bmy-website-child-theme%5D/assets/css/bootstrap.css?ver=5.7.1&#8242);
   media=’all’ /> <script src=’[http://[my-website]/wp-content/themes/%5Bmy-website-child-theme%5D/assets/js/bootstrap.js?ver=5.7.1&#8242](http://[my-website]/wp-content/themes/%5Bmy-website-child-theme%5D/assets/js/bootstrap.js?ver=5.7.1&#8242);
   id=’bootstrap-js’></script>
 * You need to use CTRL+F5 to empty your cache !
 *  [Leo](https://wordpress.org/support/users/leohsiang/)
 * (@leohsiang)
 * [5 years ago](https://wordpress.org/support/topic/enqueue-code-for-child-theme/#post-14417521)
 * Thanks for sharing!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Enqueue code for child theme’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/generatepress/3.6.1/screenshot.
   png)
 * GeneratePress
 * [Support Threads](https://wordpress.org/support/theme/generatepress/)
 * [Active Topics](https://wordpress.org/support/theme/generatepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/generatepress/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/generatepress/reviews/)

## Tags

 * [child theme](https://wordpress.org/support/topic-tag/child-theme/)
 * [enqueue](https://wordpress.org/support/topic-tag/enqueue/)

 * 6 replies
 * 3 participants
 * Last reply from: [Leo](https://wordpress.org/support/users/leohsiang/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/enqueue-code-for-child-theme/#post-14417521)
 * Status: not resolved