DigitalMakers Jan 4, 2018 · 3:11 pm #8519 Hi,
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() . '/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() . '/js/scripts.js', array ( 'jquery' ), '1.0', true );
}
add_action( 'wp_enqueue_scripts', 'customScripts' );
style.css
/*
Theme Name: Polestar Child
Author: Puro
Author URI: http://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!
Andrew Misplon Puro Jan 4, 2018 · 5:33 pm #8520 Hi 🙂
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.
DigitalMakers Jan 5, 2018 · 8:13 am #8529 This reply has been marked as private.
DigitalMakers Jan 5, 2018 · 1:30 pm #8532 This reply has been marked as private.
Andrew Misplon Puro Jan 5, 2018 · 1:36 pm #8533 Thanks 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() . '/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() . '/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 🙂
DigitalMakers Jan 5, 2018 · 1:43 pm #8534 Hi Andrew,
it solves the problem with the child theme. Thanks for the solution!
Andrew Misplon Puro Jan 5, 2018 · 2:02 pm #8535 Awesome 🙂 Glad to hear that did the trick and sorry for the hassle. Chat soon, cheers!