Tagged: ambition, child theme, CSS
- This topic has 3 replies, 2 voices, and was last updated 7 years, 7 months ago by Theme Horse Support Team.
-
AuthorPosts
-
May 18, 2017 at 7:18 am #51410abcParticipant
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,
HansMay 18, 2017 at 8:19 am #51411abcParticipantHere’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.
May 18, 2017 at 9:14 am #51412abcParticipantOkay 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.
May 18, 2017 at 11:56 am #51415Theme Horse Support TeamKeymasterThat’s great Hans
Thank you!
-
AuthorPosts
- You must be logged in to reply to this topic.