0

I am very new to website building, and I am currently trying to edit a theme (Change colors of objects etc).

I have created a child theme based on the Alpha Store and created style.css and functions.php as instructed on the alpha store child theme set up.

Style.css as follows

/*
 Theme Name: Alpha Store child
 Theme URI: http://themes4wp.com/product/alpha-store/
 Description: Child theme for Alpha Store
 Author: Themes4WP
 Author URI: http://themes4wp.com/
 Template: alpha-store
 Version: 1.0.0
*/

Functions.php as follows

<?php
/**
 * Function describe for Alpha Store child
 * 
 * @package alpha-store-child
 */

add_action( 'wp_enqueue_scripts', 'alpha_store_child_enqueue_styles', PHP_INT_MAX);
function alpha_store_child_enqueue_styles() {
 $parent_style = 'alpha-store-parent-style';

 wp_enqueue_style( 'alpha-store-style', get_template_directory_uri() . '/style.css' );
 wp_enqueue_style( 'alpha-store-child-style', get_stylesheet_directory_uri() . '/style.css', array( 'parent-style') );
}

However when I make changes in browser, they disappear when the website reloads.

I have a feeling it is something to do with the functions.php as the information is correct in the child style.css but the website keeps loading the parent style.css

please help!

This screenshot shows how the parent style.css is overriding child style.css

This screenshot shows how the parent style.css is overriding child style.css

1
  • I'm having the same issue, when you check in the element inspector, does your stylesheet appears blank?
    – Asaf Lopez
    Jun 15, 2017 at 5:50

2 Answers 2

0

Did you enable the child-theme? When using child-themes you should enable the child instead of its parent.

However when I make changes in browser, they disappear when the website reloads.

Are you using the inspector of your browser? When making changes in there, you should also apply these in your css file via FTP ( which is located at get_template_directory_uri() . '/style.css').

The inspector can only change things locally!

3
  • When editing in browser I am saving the css file locally and then uploading via the ftp, but the file just reverts everytime
    – Dan
    May 17, 2017 at 9:22
  • Also the active style.css is coming from the parent theme, not the child theme
    – Dan
    May 17, 2017 at 9:40
  • And yes the child theme is enabled
    – Dan
    May 17, 2017 at 9:49
0

I can see that the child-theme style.css is enqueued with parent-style dependency, but the parent style is identified with alpha-store-style, not parent-style.

You should change these lines:

wp_enqueue_style( 'alpha-store-style', get_template_directory_uri() . '/style.css' );
 wp_enqueue_style( 'alpha-store-child-style', get_stylesheet_directory_uri() . '/style.css', array( 'parent-style') );

With:

wp_enqueue_style( 'alpha-store-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'alpha-store-child-style', get_stylesheet_directory_uri() . '/style.css', array( 'alpha-store-style') );
8
  • I can not see anything else wrong in your code. You need to provide more detailed information about the problem.
    – cybmeta
    May 17, 2017 at 9:32
  • How the style.css is loaded in the parent theme? Why are you using PHP_INT_MAX for wp_enqueue_scripts action? Are style.css from child and parent theme loaded in in the frontend? Anything else about the problem and context would be usefull to understand the problem.
    – cybmeta
    May 17, 2017 at 9:57
  • okay from the begginning, I am using the inpector tool to make visual changes to the style.css file locally, then saving that file and uploading it via ftp. However the original css file keeps reappearing. In addition, when using the inspection tool it appears that the site is actively running off the parent style.css despite the child theme being active. I was using the PHP_INT_MAX to try and force the site to run off the child style.
    – Dan
    May 17, 2017 at 10:18
  • So from what i understand, the functions.php in my active child theme is supposed to run the site on the child style however when i am making my edits the active style.css is in the parent theme despite the child theme being active
    – Dan
    May 17, 2017 at 10:22
  • Sorry but I'm not sure to follow you. With your code, both parent and child style.css should be loaded, are they both loaded?. Which file are you editing and updating via FTP?. About changes not appearing after updating the file: have you try to refresh browser cache?
    – cybmeta
    May 17, 2017 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.