• Resolved naeko

    (@naeko)


    Ma configuration WP actuelle :

    – WordPress : 4.9.1
    – PHP/MySQL : 7.0.17 / 5.5.55
    – Theme : Hemingway_modifs
    – Extensions en place : Akismet Anti-Spam (4.0.1), FooGallery (1.4.8), Forums – wpForo (1.4.2), Forum_wordpress_fr (4.1), Google Forms (0.91), Max Mega Menu (2.4), SI Captcha Anti-Spam (3.0.3), Tabbed Login Widget (1.1.2), Widget Instance (0.9.4), World of Warcraft Recruitment – Legion (1.0), WoWpi – the World of Warcraft API Armory plugin (2.3.5), WoW Progress (1.9.0), WOW Recruitment Widget (1.4.12), WP User Avatar (2.0.9)
    – website : https://www.heaven-dream.fr/heaven-dream
    – host : Apache

    I have a problem : Yesterday, Uptades all my extension/theme, and now some modifications I have done on my child theme (based on hemingway theme) have been modified/deleted, but my css on my child theme are not modified, so I dont understand why…

    My css child theme :

    /*
    Theme Name: Hemingway_modifs
    Description: Modifications du theme Hemingway
    Author: Naeko - Hemingway
    Author URI: https://www.heaven-dream.fr/heaven-dream/
    Template: Hemingway 
    Version: 0.1.0
    */
    
    ::selection {
    	background: #e7a23a;
    	color: #333;
    }
    
    p
    {
        font-size: 17px;
    }
    
    .sidebar {
        background: #6d6d6d; 
    	border: 3px solid #b1b1b1;
    }
    
    .widget:last-child {
    	padding-bottom: 0;
    	border-bottom: 0;
    	margin-bottom: 20px;
    	margin-top: 20px;
    	margin-left: 8px;
        margin-right: 8px;
    }
    
    .widget {
    	padding-bottom: 15%;
    	border-bottom: 4px solid #c2c2c2;
    	margin-bottom: 15%;
    	margin-top: 20px;
    	margin-left: 8px;
    	margin-right: 8px;
    }
    
    .widget-title {
    	font-family: 'Raleway', sans-serif;
    	font-size: 0.9rem;
    	text-transform: uppercase;
    	font-weight: 700;
    	margin-bottom: 20px;
    	color: #fff;
    }
    
    .post, 
    .page { 
    	padding-bottom: 10%; 
    	border-bottom: 4px solid #7b7b7b;
    	margin-bottom: 10%;
    }
    
    .section.bg-dark { background: #e9a53c; }
    
    .post-title,
    .post-title a { color: #999; }
    
    body {
    	margin: 0;
    	padding: 0;
    	border: none;
    	background: #FFF;
    	color: #999;
    	font-family: 'Lato', sans-serif;
    	font-size: 18px;
    	-webkit-font-smoothing: subpixel-antialiased;
    }
    
    .post-content h1, .post-content h2, .post-content h3, .post-content h4, .post-content h5, .post-content h6 {
    	margin: 50px 0 25px;
    	color: #999;
    	line-height: 120%;
    }

    The frame for my widget had border and a diferent background color, but now faded away, color of my font has been modified too…. If anyone know why x)

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter naeko

    (@naeko)

    Solved my problem with additional CSS on wordpress personalization theme, but It’s weird ^^’

    Theme Author Anders Norén

    (@anlino)

    Hi @naeko,

    There weren’t any changes in how the Hemingway CSS in enqueued in the latest version, so that shouldn’t have caused any issues. There also weren’t any direct edits to the CSS file itself, so the specificity shouldn’t have changed. Which styles specifically are not being applied from the child theme CSS?

    — Anders

    Hello Anders,

    I have the same Problem. With 1.58 the style.css in my childtheme folder will not load. With 1.56 it works fine.

    In the function.php is this:

    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'Hemingway', get_template_directory_uri() . '/style.css' );
    }

    Me too. Issue is incorrectly marked as resolved, OP actually extended their CSS to workaround.
    The issue first appears in version 1.57 which is why foomep’s site (and ours) works ok with v1.56
    There are a lot of changes between these versions, and unfortunatley the changelog.txt disappears at v1.57
    However, I have diff-ed a number of files and I think that the problem arises in functions.php at line 89. If I revert:
    wp_enqueue_style( ‘hemingway_style’, get_template_directory_uri() . ‘/style.css’ );
    back to:
    wp_enqueue_style( ‘hemingway_style’, get_stylesheet_uri() );
    the child theme CSS is correctly loaded.
    I’m not saying that this is necessarily the solution, but the problem definitely relates to the child style.css not being correctly enqueued.

    Theme Author Anders Norén

    (@anlino)

    Hi @inceweb,

    Yeah, I forgot that this change had also made its way into Hemingway when I updated my themes at the end of November. The change was made to make Hemingway handle stylesheet the proper way, which is for it to always load its own stylesheet. The old solution – using get_stylesheet_url() – would load the child theme CSS if a child theme was active, instead of loading the parent theme CSS.

    I’d recommend you to update your child theme functions.php file with the following:

    function hemingway_child_load_style() {
    	if ( ! is_admin() ) {
            wp_register_style( 'hemingway_style', get_template_directory_uri() . '/style.css' );
    	    wp_enqueue_style( 'hemingway_child_style', get_stylesheet_uri(), array( 'hemingway_style' ) );
    	}
    }
    add_action( 'wp_print_styles', 'hemingway_child_load_style' );

    The code will make WordPress load Hemingways own styles first, followed by your child theme styles, which means the CSS in Hemingway can be overwritten by the child theme. If you change the Hemingway code directly, your change will be overwritten the next time Hemingway is updated (since theme updates overwrite the entire theme folder with the latest version of the theme).

    As for the changelog, it has been moved into readme.txt to follow the new readme.txt guidelines for themes in the WordPress directory.

    — Anders

    Many thanks, Anders – I’ve updated our child theme’s functions.php as recommended, removed the edit I had made to the Hemingway functions.php and it is all working perfectly.

    I guess I have a blindspot for anything called readme.txt ??

    Thanks again.

    For the benefit of others reading this, amending the child’s functions.php in this way ensures that the Hemingway style.css is loaded immediately followed by the child’s style.css, so we can fully customise the theme without worrying about Hemingway updates overwriting our changes.

    This is different to the code provided in the WordPress Codex for child themes.

    How must i change my functions.php? – i have copyid the code in.
    But now i can’t login into my backend.
    I have renamed my child Folder so i can login, but dont know how my child dont work.

    Greeting Pixel

    pixeljunky,
    It sounds like you have invalid syntax in your funtions.php – you could try posting it here so we can look.
    If I had to guess, I would say that you have pasted the code after the final “?>” in the file – it must be in front of it, otherwise the PHP will not be interpreted.

    For example:

    <?php
    /**
    * Enqueues child theme stylesheet, loading first the parent theme stylesheet.
    */
    function hemingway_child_load_style() {
    if ( ! is_admin() ) {
    wp_register_style( ‘hemingway_style’, get_template_directory_uri() . ‘/style.css’ );
    wp_enqueue_style( ‘hemingway_child_style’, get_stylesheet_uri(), array( ‘hemingway_style’ ) );
    }
    }
    add_action( ‘wp_print_styles’, ‘hemingway_child_load_style’ );
    ?>

    Thank you inceweb.

    I have found it last night. 2 errors in functions.php made by me.

    I made an emty line to much, and i saved in UTF-8 instead of UTF-8 ohne BOM

    Thank you for your quick response

    Greetings
    Pixel

    Hello @anlino,

    First of all, thanks for your theme I love it! ??

    I’m quite in same case but after reading everything I can’t find a solution.
    Everything was working fine but since a theme update during decembre 2017 my child css are not working anymore.

    Here’s my website:
    https://www.location-golfe-de-lava.com/

    Here’s is my style.css (in “/themes/hemingway-child/”):

    /*
    Theme Name:     hemingway-child
    Template:       hemingway
    Text Domain:    hemingway-child
    */
    @import url("../hemingway/style.css");
    
    .post-title, .post-title a {
        color: red;
    }

    This is not working, only when I modify CSS in the parent theme.

    Can you help me ?

    Fred

    • This reply was modified 6 years, 9 months ago by Fwe34000.
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Child theme problem’ is closed to new replies.