Support

Home Forums Event Espresso Premium Getting Child Theme Working

Getting Child Theme Working

Posted: December 19, 2016 at 1:39 pm

Viewing 4 reply threads


rhj4

December 19, 2016 at 1:39 pm

A good number of your recommendations require modification of functions.php. In order to do this right, it appears that implementing a child theme is an appropriate first step, but I am having trouble getting mine working. I am not seeing any diagnostics, but when it comes up, it has lost much of the styling. My functions.php file contains this code:

add_action( ‘wp_enqueue_scripts’, ‘iced_mocha_theme_enqueue_styles’ );
function iced_mocha_theme_enqueue_styles() {

$parent_style = ‘iced-mocha-master-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')
    );
}
add_action( 'wp_enqueue_scripts', 'iced_mocha_theme_enqueue_styles' );

The child theme name is ‘iced-mocha-child’ and it is in the same folder as the iced-mocha-master. The iced-mocha-child theme does appear in my themes list, but when I activate it, the background goes to black.

Can you point me in the right direction here?

Thanks!


Josh

  • Support Staff

December 19, 2016 at 1:50 pm

Hi Bob,

One step you may have missed is the child theme folder needs its own style.css file. There’s further directions in this codex article:

https://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme


rhj4

December 19, 2016 at 1:53 pm

Josh,

I read that article and created the style.css and functions.php files. Here is the content of my style.css:

/*
Theme Name: Iced Mocha Child
Theme URI: http://connexions.world/iced-mocha-child/
Description: Iced Mocha Child Theme
Author: Bob Jones
Author URI: http://rhj4.com
Template: iced-mocha-master
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: iced-mocha-child
*/


Josh

  • Support Staff

December 19, 2016 at 2:58 pm

Hi Bob,

Unless you’re actually modifying theme files other than functions.php, setting up a child theme is unnecessary. In most cases, it’s best to add custom functions to a custom functions plugin.


rhj4

December 19, 2016 at 4:32 pm

Thanks for that reminder. It seems to work pretty well.

Viewing 4 reply threads

The support post ‘Getting Child Theme Working’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso