• Resolved karela

    (@karela)


    Have not included a link because the maintenance mode screen is up. Would it still help?

    I am trying to make a child theme and it seemed to be working out alright- in principle. styles.css sheet, functions.php and as per the dashboard’s request an index.php file (I just copied the one from Twenty Seventeen).

    It shows me my theme with the theme image and lets me activate it, however there seems to be a problem with something…

    1) The site is either blank or has no css
    2)I do not see several of the options for customizing (header image, widgets)

    Here is my styles.css code, copied from Twenty Seventeen pretty much verbatim
    /*
    Theme Name: Twenty Seventeen Child
    Theme URI: https://www.ads-software.com/themes/twentyseventeen-child/
    Author: Kimberly
    Author URI: https://www.ads-software.com/
    Description: Twenty Seventeen brings your site to life with header video and immersive featured images. With a focus on business sites, it features multiple sections on the front page as well as widgets, navigation and social menus, a logo, and more. Personalize its asymmetrical grid with a custom color scheme and showcase your multimedia content with post formats. Our default theme for 2017 works great in many languages, for any abilities, and on any device.
    Version: 1.4
    License: GNU General Public License v2 or later
    License URI: https://www.gnu.org/licenses/gpl-2.0.html
    Text Domain: twentyseventeen-child
    Tags: one-column, two-columns, right-sidebar, flexible-header, accessibility-ready, custom-colors, custom-header, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, post-formats, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready

    This theme, like WordPress, is licensed under the GPL.
    Use it to make something cool, have fun, and share what you’ve learned with others.
    */

    And here is my functions.php code


    <?php
    function my_theme_enqueue_styles() {

    $parent_style = ‘twentyseventeen-style’; // This is ‘twentyseventeen-style’ for the Twenty Seventeen 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’ );
    ?>

    Any suggestions are appreciated, because otherwise I am just going to keep modifying Twenty Seventeen and that always makes me feel uncomfortable.

    • This topic was modified 6 years, 8 months ago by karela.
    • This topic was modified 6 years, 8 months ago by karela.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Just some quick thoughts;

    • Your stylesheet shouldn’t be named “styles.css”. It should be “style.css”
    • Your stylesheet shouldn’t be a copy of the parent theme. A lot of that is unnecessary, it should just be something like:
      
      /*
       Theme Name:   Twenty Seventeen Child
       Template:     twentyseventeen
      */
      
    Thread Starter karela

    (@karela)

    Thank you Andrew Nevins!

    When I put in the stylesheet copied from your post it worked like a charm! I guess there must have been extraneous information in there with an error of some sort.

    The sheet was actually named style.css, I made a typo when I posted.

    That is not working for me. If I put in my child theme a style.css file only with

    
    /*
     Theme Name:   Twenty Seventeen Child
     Template:     twentyseventeen
    */

    The result is a near-plain page, like if the styles were incomplete. If I CLONE the original style.css to my child theme and modify this cloned CSS file, all is working fine, but I’m making the user read two complete “style.css” files (the original and the cloned and modified one).

    Any suggestion?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    @rafaellinuxuser, Sounds like you’re missing the functions.php setup of your Child Theme. If that is intentional then you need to instead use the @import rule beneath the comments of your style.css file:

    
    /*
     Theme Name:   Twenty Seventeen Child
     Template:     twentyseventeen
    */
    
    @import url('../twentyseventeen/style.css');
    

    Otherwise read up the functions.php instructions: https://codex.www.ads-software.com/Child_Themes

    I had no reason to make it as I was doing it, simply, it worked as some WP versions ago. So, I did the instructions that were in the link you provided, and all works as it should.
    Unfortunately, I need now to look for my style changes and put only them in my child “styles.css” file, but this will increase the page load speed, so THANK YOU, you gave me the perfect answer and even an alternative, what else can I ask for?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Problems with Twenty Seventeen child theme’ is closed to new replies.