badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

Child theme CSS no recognised

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #51410
    abc
    Participant

    Dear Team Horse,

    Thank you for making available some of your themes for free!
    I have created a child theme for Ambition in order to be able to make easy and update-resilient changes to style.css. I’ve followed the instructions on https://codex.wordpress.org/Child_Themes, creating a child folder putting a functions.php and a style.css in there that holds the CSS code I want to change. My functions.php looks like this:

    <?php
    function ambition_enqueue_styles() {
    
        $parent_style = 'ambition-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', 'ambition_enqueue_styles' );
    ?> 

    The child theme shows up in WordPress (incl. the metadata in the child theme’s style.css) and I selected it. But the child CSS continues to be ignored. What am I missing here?

    Thank you so much for any hint you can give me on how to create a child theme for Ambition.

    Best,
    Hans

    #51411
    abc
    Participant

    Here’s my child CSS:

    /*
     Theme Name:   Ambition Child
     Theme URI:    http://example.com/ambition-child/
     Description:  Ambition Child Theme
     Author:       Authorname
     Author URI:   https://www.myURL.com
     Template:     ambition
     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:  ambition-child
    */
    
    .page-title-wrap {
    	background-color: #ffffff;
    	padding: 60px 0 0 80px;
    	text-align: left;
    }
    
    .page-title {
    	color: #89a452;
            font-weight: 700;
    }
    
    .page-title a {
    	color: #89a452;
    }

    Could this be a file permissions issue? I saw that the child CSS file has different permissions from the original one.

    #51412
    abc
    Participant

    Okay I found the solution myself:

    The problem was the version number in the CSS file. When I used 1.0.0 (see example above), as per the WordPress reference page, my style.css was ignored by WordPress. As soon as I aligned the version number with the one from Ambition’s parent CSS (currently 1.3), it started taking the child CSS into account.

    I think this should be mentioned somewhere either on Theme Horse’s site or here https://codex.wordpress.org/Child_Themes. Not sure who to contact there but will give it a shot.

    #51415

    That’s great Hans

    Thank you!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.