- This topic has 6 replies, 2 voices, and was last updated 6 years, 10 months ago by Andrew Misplon.
Tagged: Child Theme css functions
- AuthorPosts
- January 4, 2018 at 3:11 pm #8519
DigitalMakersParticipantHi,
We are working on a new website with a fresh install of WordPress 4.9.1 and Polestar theme 1.1, but the child theme is not working.
These are the files:
functions.php
<?php /** * Enqueue the parent theme stylesheet. */ function polestar_child_scripts() { wp_enqueue_style( 'polestar-parent-style', get_template_directory_uri() . '//puro-4401.kxcdn.com/style.css' ); } add_action( 'wp_enqueue_scripts', 'polestar_child_scripts', 8); function customScripts() { wp_enqueue_style( 'font-awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' ); wp_enqueue_script( 'custom-scripts', get_stylesheet_directory_uri() . '//puro-4401.kxcdn.com/js/scripts.js', array ( 'jquery' ), '1.0', true ); } add_action( 'wp_enqueue_scripts', 'customScripts' );
style.css
/* Theme Name: Polestar Child Author: Puro Author URI: https://purothemes.com/ Theme URI: https://wordpress.org/themes/polestar/ Description: Polestar Child Theme Version: 1.0.0 Template: polestar Text Domain: polestar-child Domain Path: /languages/ */
The source code only charges the parent style.css but twice, one by this functions.php and another that is minified.
Could you please help with the problem? Thanks!
January 4, 2018 at 5:33 pm #8520
Andrew MisplonKeymasterHi 🙂
Thanks for posting.
If possible, please, can you share a link to a page with the problem so I can inspect the specific CSS rule you’re having trouble with and take a look at the file setup live. Everything above looks normal so it’ll be helpful to take a look at a specific customisation you’re having a trouble with.
January 5, 2018 at 8:13 am #8529
DigitalMakersParticipantThis reply has been marked as private.January 5, 2018 at 1:30 pm #8532
DigitalMakersParticipantThis reply has been marked as private.January 5, 2018 at 1:36 pm #8533
Andrew MisplonKeymasterThanks for the update and for raising this. Here, the parent is doing things slightly differently: https://github.com/purothemes/polestar/blob/master/functions.php#L152. The unminified version still has to be included for WP directory purposes. The demo child theme is incorrect, sorry about that and thanks again for raising this. Please, try changing your child functions file to:
<?php /** * Enqueue theme scripts and styles. */ function polestar_child_scripts() { // Child theme stylesheet. wp_enqueue_style( 'polestar-child', get_stylesheet_directory_uri() . '//puro-4401.kxcdn.com/style.css' ); // Font Awesome. wp_enqueue_style( 'font-awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' ); // Custom Scripts wp_enqueue_script( 'polestar-child-scripts', get_stylesheet_directory_uri() . '//puro-4401.kxcdn.com/js/scripts.js', array( 'jquery' ), '1.0', true ); } add_action( 'wp_enqueue_scripts', 'polestar_child_scripts', 8 );
Let me know how that goes and we’ll take it from there 🙂
January 5, 2018 at 1:43 pm #8534
DigitalMakersParticipantHi Andrew,
it solves the problem with the child theme. Thanks for the solution!
January 5, 2018 at 2:02 pm #8535
Andrew MisplonKeymasterAwesome 🙂 Glad to hear that did the trick and sorry for the hassle. Chat soon, cheers!
- AuthorPosts
You must be logged in to reply to this topic.