Home › Forums › Air WordPress Theme › Custom css in child-theme not working
- This topic has 4 replies, 2 voices, and was last updated 8 years, 6 months ago by
panjijayasutra.
-
AuthorPosts
-
November 9, 2017 at 10:58 am #13904
I have successfully installed my child-theme. and activated it, but when i put my custom css code to file custom.css in folder air-theme-child , it does nothing.
in the air-theme-child i have 4 files :
– custom.css
– function.php
– screenshot.png
– style.cssCode in custom.css :
.myc {
color: red;
background-color: yellow;
}code in function.php:
<?php
function ux_frontend_styles() {
wp_register_style(‘customstyle-css’, get_stylesheet_directory_uri() . ‘/custom.css’, array(), ‘1.0’, ‘screen’);
wp_enqueue_style(‘customstyle-css’);
}
add_action(‘wp_enqueue_scripts’, ‘ux_frontend_styles’,102);
?>Code in style.css:
/*
Theme Name: Air Child Theme
Theme URI: http://themeforest.net/user/bwsm/portfolio
Description: A Child Theme for the Air WordPress Theme. If you plan to do a lot of file modifications we recommend to use this Theme instead of the original Theme. Updating wil be much easier then.
Author: UXteam / Bwsm
Author URI: https://seatheme.net
Template: air-theme
Version: 1.0
*/help me please, what is missing with my code ?
thanks for help.November 10, 2017 at 3:44 am #13911Hi, please send your wp-admin(url/user/pass) via
my profile contact form (you need login on ThemeForest), I’ll log in to check it.Regards!
November 10, 2017 at 6:35 am #13918Hii,
Thanks for replay.
But i still test it on my localhost computer. not in production.can you give me correct code format in file function.php at child-theme.
Thanks for help.
November 10, 2017 at 6:40 am #13919Hi
Please click “view page source”, check if there is the custom.css, like
<link rel='stylesheet' id='customstyle-css-css' href='http://localhost:8888/wordpress/wp-content/themes/air-child/custom.css?ver=1.0' type='text/css' media='screen' />Please make sure the origin theme(Air theme) folder name is: “air-theme”
Regards!
November 11, 2017 at 6:16 am #13924Hii,
Thanks for replay,i have changed code file function.php in child-theme like this and work successfuly:
<?php function use_parent_theme_stylesheet() { return get_template_directory_uri() . '/style.css'; } function my_theme_styles() { $themeVersion = wp_get_theme()->get('Version'); wp_enqueue_style('child-theme-style', get_stylesheet_directory_uri() . '/custom.css', array(), $themeVersion); } add_filter('stylesheet_uri', 'use_parent_theme_stylesheet'); add_action('wp_enqueue_scripts', 'my_theme_styles', 20); ?> -
AuthorPosts
- You must be logged in to reply to this topic.
