Title: Problem Getting Child Theme Functions.php Right
Last modified: May 10, 2019

---

# Problem Getting Child Theme Functions.php Right

 *  [OscarGuy](https://wordpress.org/support/users/oscarguy/)
 * (@oscarguy)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/problem-getting-child-theme-functions-php-right/)
 * I have not gone live yet because I don’t want my site to go down, but I went 
   to the wordpress.org site to get info on how to create a stylesheet and I think
   there might be errors in the displayed enqueuing code.
 * Here’s what it shows:
 *     ```
       <?php
       add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
       function my_theme_enqueue_styles() {
           wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
   
       }
       ?>
       ```
   
 * It then follows with:
 *     ```
       <?php
       add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
       function my_theme_enqueue_styles() {
   
           $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
   
           wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
           wp_enqueue_style( 'child-style',
               get_stylesheet_directory_uri() . '/style.css',
               array( $parent_style ),
               wp_get_theme()->get('Version')
           );
       }
       ?>
       ```
   
 * I’m pretty sure I need to replace the > with >, but I don’t think that’s the 
   only problem as the editor I’m using says that the & in & is incorrect. Can someone
   help me confirm all of the sections I need to replace in this one and advise 
   if someone can go to the website and fix that so that others don’t get the wrong
   information?

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

 *  Thread Starter [OscarGuy](https://wordpress.org/support/users/oscarguy/)
 * (@oscarguy)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/problem-getting-child-theme-functions-php-right/#post-11517264)
 * Weird, the parts that were a problem > were fixed when I put them in code here.
   That’s very odd.
 *  Thread Starter [OscarGuy](https://wordpress.org/support/users/oscarguy/)
 * (@oscarguy)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/problem-getting-child-theme-functions-php-right/#post-11517275)
 * I copied and pasted what generated above and it still does not work. Here’s the
   contents of the functions.php file as I currently have it. I am using the “Live
   Preview” to make sure that it works before going further and it still doesn’t.
 *     ```
       <?php
       add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
       function my_theme_enqueue_styles() {
           wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
       }
       add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
       function my_theme_enqueue_styles() {
           $parent_style = 'frontier'; 
           wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
           wp_enqueue_style( 'frontier-child',
               get_stylesheet_directory_uri() . '/style.css',
               array( $parent_style ),
               wp_get_theme()->get('Version')
           );
       }
       add_filter( 'the_content_more_link', 'modify_read_more_link' );
       function modify_read_more_link() {
       return 'Click here to continue reading this article';
       }
       ?>
       ```
   
    -  This reply was modified 7 years, 3 months ago by [OscarGuy](https://wordpress.org/support/users/oscarguy/).
 *  [roscfi](https://wordpress.org/support/users/roscfi/)
 * (@roscfi)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/problem-getting-child-theme-functions-php-right/#post-11519696)
 * Hey guy! What are you trying to do? A child Theme?
 *  Thread Starter [OscarGuy](https://wordpress.org/support/users/oscarguy/)
 * (@oscarguy)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/problem-getting-child-theme-functions-php-right/#post-11527694)
 * Yes.
 *  [roscfi](https://wordpress.org/support/users/roscfi/)
 * (@roscfi)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/problem-getting-child-theme-functions-php-right/#post-11536027)
 * Please, take a look in your browser inspector and see in the **network** tab 
   what is the state of the **style.css**, if there is a style.css with status 404,
   try to activate another theme and then activate again your child-theme.
 *  Thread Starter [OscarGuy](https://wordpress.org/support/users/oscarguy/)
 * (@oscarguy)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/problem-getting-child-theme-functions-php-right/#post-11544935)
 * So the code above is correct? That’s what I’m trying to verify. I am previewing
   the changes with the live preview functionality of the themes as I don’t want
   to activate the child and find the entire site goes down.
 *  [roscfi](https://wordpress.org/support/users/roscfi/)
 * (@roscfi)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/problem-getting-child-theme-functions-php-right/#post-11559974)
 * I’ve take a look in the [Child Theme](https://developer.wordpress.org/themes/advanced-topics/child-themes/)
   page of WordPress and at a child theme I’ve created. I think you should put the
   string “frontier-style” as it says in the comment after the $parent_style variable
   for the Twenty Fifteen Theme. I let my child-style as it is in the code in the
   Child Theme WordPress page.
 *     ```
       <?php
       add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
       function my_theme_enqueue_styles() {
   
           $parent_style = '<strong>frontier-style</strong>'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
   
           wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
           wp_enqueue_style( 'child-style',
               get_stylesheet_directory_uri() . '/style.css',
               array( $parent_style ),
               wp_get_theme()->get('Version')
           );
       }
       ```
   
    -  This reply was modified 7 years, 2 months ago by [roscfi](https://wordpress.org/support/users/roscfi/).
      Reason: Make it clearly
 *  Thread Starter [OscarGuy](https://wordpress.org/support/users/oscarguy/)
 * (@oscarguy)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/problem-getting-child-theme-functions-php-right/#post-11562538)
 * Here’s how it currently looks (I may have modified it at some point) and I have
   changed it to show frontier-style where indicated and it still does not appear
   to work.
 *     ```
       <?php
       add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
       function my_theme_enqueue_styles() {
           wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
       }
       add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
       function my_theme_enqueue_styles() {
            $parent_style = 'frontier-style';
            wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
           wp_enqueue_style( 'frontier-child',
               get_stylesheet_directory_uri() . '/style.css',
               array( $parent_style ),
               wp_get_theme()->get('Version')
           );
       }
       add_filter( 'the_content_more_link', 'modify_read_more_link' );
       function modify_read_more_link() {
       return 'Click here to continue reading this article';
       }
       ?>
       ```
   
 *  [roscfi](https://wordpress.org/support/users/roscfi/)
 * (@roscfi)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/problem-getting-child-theme-functions-php-right/#post-11566582)
 * You’re calling a function twice with the add action.
 *     ```
       <?php
       add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
       function my_theme_enqueue_styles() {
           wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
       }
       add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
       function my_theme_enqueue_styles() {...
       ```
   
 * And I think that’s not going to works well.
    Try to replace the code you have
   in your functions.php for:
 *     ```
       <?php
       add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
       function my_theme_enqueue_styles() {
   
           $parent_style = 'frontier-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
   
           wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
           wp_enqueue_style( 'child-style',
               get_stylesheet_directory_uri() . '/style.css',
               array( $parent_style ),
               wp_get_theme()->get('Version')
           );
       }
       ```
   
 *  [roscfi](https://wordpress.org/support/users/roscfi/)
 * (@roscfi)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/problem-getting-child-theme-functions-php-right/#post-11645909)
 * [@oscarguy](https://wordpress.org/support/users/oscarguy/) any news?
 *  Thread Starter [OscarGuy](https://wordpress.org/support/users/oscarguy/)
 * (@oscarguy)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/problem-getting-child-theme-functions-php-right/#post-11856686)
 * I apologize for not responding sooner. I have consistently not found any time
   to work on this. That seems to have fixed the problem. Thank you.
 * Now I just have to figure out how to get some of other changes I’ve made into
   my style sheet because apparently, I’ve made some others and I’m not sure where
   the differences are…that, though, might just take a line-by-line comparison of
   the base style sheet and the one I later created…

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

The topic ‘Problem Getting Child Theme Functions.php Right’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 11 replies
 * 2 participants
 * Last reply from: [OscarGuy](https://wordpress.org/support/users/oscarguy/)
 * Last activity: [6 years, 12 months ago](https://wordpress.org/support/topic/problem-getting-child-theme-functions-php-right/#post-11856686)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
