• Resolved lauratraveler

    (@lauratraveler)


    Hi,
    I’m trying to create my first child theme ever and I was following the instructions here https://codex.wordpress.org/Child_Themes#Referencing_.2F_Including_Files_in_Your_Child_Theme. When it comes to creating the functions.php for the child theme, it says

    parent-style is the same $handle used in the parent theme when it registers its stylesheet. For example, if the parent theme is twentyfifteen, by looking in its functions.php for its wp_enqueue_style() call, you can see the tag it uses there is ‘twentyfifteen-style’. In your child code, replace the instance of ‘parent-style’ with ‘twentyfifteen-style’

    What’s the parent-style I should use for Pinnacle? I can’t find anything like ‘pinnacle-style’ or even the word ‘style’ in the functions.php
    Thanks!

    • This topic was modified 6 years, 7 months ago by lauratraveler.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello Laura,

    We actually have child themes available for download for free from here:
    https://www.kadencethemes.com/child-themes/

    Just download from there and install as a regular theme, and you should be set!

    -Kevin

    Thread Starter lauratraveler

    (@lauratraveler)

    Thanks, Kevin! I’ve just had a look at the child theme you have for download for Pinnacle. The functions.php doesn’t include the $parent_style. This is the code I was hoping to get to:

    `<?php
    function my_theme_enqueue_styles() {

    $parent_style = ‘<strong>parent-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’)
    );
    }
    add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
    ?>`

    Does the functions.php not require all this? I’m totally clueless, but basically, I wanted to create a child theme so I can keep a modification I made to the entry-meta-subhead.php from one theme update to the next.

    I already have this in the style.css under the pinnacle child folder

    /*
    Theme Name:Pinnacle Child
    Theme URI:https://kadencethemes.com/product/pinnacle-free-theme/
    Description:Pinnacle is a bold theme with versatile options and multiple styles. This theme is loaded with features and tools that allow full creativity to be released into a unique site. Built with a modern flat design, its fully responsive layout make for easy navigation on mobile/tablet displays. Pinnacle is perfect for any kind of business, online store, portfolio, or personal site. It is fully compatible with woocommerce and gives you a unique layout for an ecommerce site. Pinnacle was built and designed by <a href="http://kadencethemes.com/">Kadence Themes</a>.
    Version:1.0.0
    Author:Kadence Themes
    Author URI:https://www.kadencethemes.com/
    Template: pinnacle
    Tags: grid-layout, two-columns, one-column, custom-colors, custom-menu, featured-images, translation-ready, theme-options, e-commerce, photography, portfolio
    License: GPL
    License URI: http://www.gnu.org/copyleft/gpl.html
    Text Domain: pinnacle-child
    */

    No, that is not necessary. Everything included in our child theme download is what you need for the theme to function. Just add your custom functions directly to the functions.php file and it should work!

    -Kevin

    Thread Starter lauratraveler

    (@lauratraveler)

    That’s brilliant! So to use the changes I’ve made to the entry-meta-subhead.php from one theme update to the next, would it be enough to create a ‘templates’ folder inside the pinnacle-child folder and inside the ‘templates’ folder create a new entry-meta-subhead.php file and replace the original code with my own code?

    Sounds like you’re on the right track Laura. That’s the genius of child themes. You can copy anything from the parent theme, tweak as you need it, and it will override the parent template file without harming anything, and you don’t loose your changes when the parent theme gets updated, which happens periodically, especially with Kadence themes. (They’re good that way!)

    Now the word of caution is that if something in the parent file that you are overriding is updated (for whatever reason), you’ll probably never know it because your child theme will be referenced instead of the parent theme file.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Creating a child theme’ is closed to new replies.