wordpress child theme styles.css does not want to override parent style.css - css

My child theme styles.css does not want to override parent style.css.
I am working with the wordpress theme twenty fourteen .
I have created a child theme, and through research have found the following piece of code...
require_once( get_stylesheet_directory() . '/my_included_file.php' );
My question is where exactly does this code go? I read in the functions.php. So do I put it in the first line of the page.
I want my child theme stylesheet to take priority over my parent stylesheet.
Thank you any help would be great..

You should not need that code. Once you activate the child theme, that stylesheet will be included after the parent theme's and will therefore override those in the parent theme’s stylesheet.
Read more about Child Themes at the WordPress Codex.

You can directly import your parent-theme style.css by #import url('../parent-theme-name/style.css'); in your child-theme style.css and below it write your own css code or override the parent-theme css code.
you can also use this plugin to create child theme http://wordpress.org/plugins/orbisius-child-theme-creator/

Related

Customize Enfold theme on my WP site

I've to customize the header in Enfold theme of my WP site. I placed the company logo to the left and under this I placed the primary menu. I need to add another image near to the company logo. I 'created' a theme child and I would like to add a widget to place image on the right of the company logo but the theme expected in the header the company logo and the primary menu only. Can I customize my header to do this? Can you help me please? Thank's!
If you have purchased the enfold theme, you will get the child theme along with that. Your header part (menu and logo) is running from helper-main-menu.php file which is located at enfold/includes/helper-main-menu.php
Now to get this in child theme add the header.php to your child theme and then add a folder named includes and keep a copy of helper-main-menu.php. This should be as same as in parent theme.
Now you can edit your child theme files and add as many widgets you need.
I have tested and it worked for me.Happy Coding :)
I have noticed that your theme is from themeforest so you should create a child theme, then copy your header.php in child theme folder. Then make changes on that file.
For creating a child theme, make a folder inside your 'themes' folder with you child theme name. Now the child theme should have a style sheet in it which is a must. So add a style sheet and the beginning of the child theme style sheet should be as follows:
/*
Theme Name: (theme name) Child
Theme URI: (give URL)
Description: (give description)
Version: (give your version)
Author: (author name)
Author URI: (give URL)
Template: (name of parent theme)
*/
Of these the very important thing is the 'Template' which is the parent theme name. To avoid confusion take the name of parent theme from the parent theme style sheet.
Now the second thing is the functions of your child theme. Just add a php file with the name functions.php and place the below code.
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>
This code is for enqueuing the parent theme styles. Here you go! your child theme will work now.

Child themes of twentysixteen theme

I am using twenty sixteen child theme. I need to modify the theme contents. What are the files I need to modify and how? Can anyone explain it in detail.
Advance thanks.
when i use child theme like this i get black screen
This is my site http://i.stack.imgur.com/snSX9.png How to extent the full width of my site..
Read the following documentation about the child themes
Child theme inherits all the functionality and styling of it's parent theme. If you are using child theme and a theme update is applied your changes won't be lost or overwitten
You can quickly create child theme for any theme, just follow the steps given below:
1 Create a folder and name it exactly your theme name; append -child in the name. e.g. creating child theme for twentysixteen theme would be called twentysixteen-child this folder should sit beside parent theme under wp-content/themes/
2- Your child theme should have three files.
style.css
functions.php
screenshot.png
3- In functions.php file you can override parent theme functions.
4 In style.css file you can override parent theme CSS code.
5 If you want to change header design then you have to override header.php file. For this copy header.php file of your parent theme and paste it inside your child theme folder. Now, you can modify the child theme header file as per your requirements.
6 Similarly, you can also override footer.php file in your child theme.
For more info have a look over below thread-
https://codex.wordpress.org/Child_Themes
You need to create at-least one child-theme directory and two main files (style.css & functions.php) under child theme directory. I have given example using Twenty-Thirteen WordPress theme. Step by step explanation is given

About WordPress child theme

I have created wordpress child theme from parent theme "twentythirteen". My child theme name is "twentythirteen-child".It has following content.
/*
Theme Name: twentythirteen-child
Theme URI: http://www.example.com
Description: A Twenty Thirteen child theme
Author: WPBeginner
Author URI: http://www.example.com
Template: twentythirteen
Version: 1.0.0
*/
#import url("../twentythirteen/style.css");
Unfortunately my child theme replaces the parent theme and newly created theme is applying when i activate child theme and there is no parent theme style is applied on webpage.
How can i solve this problem?
Couple things to try:
Double check to make sure your template path in the header you posted actually goes to the twenty-thirteen theme. That could be why the base styles aren't appearing.
Your child theme needs it's own style.css - you can't import that. Read more on the WordPress Child Theme Codex Page.
Make sure you didn't copy over the entire directory into the child folder. That's a common beginner mistake.
Your child theme is supposed to override the parent theme. It supersedes any parent theme files you put into it. For example, if you put a different page.html in the root of your child theme, it would replace the page.html from the twenty-thirteen parent theme.

How to make a child theme after style.css has been customized

I am working on a theme that has already been customized. Only one file in the theme has been customized, that file is the style.css. A child theme was NOT created before doing the customizations.
I would like to make a child theme so the customizations are not lost when the theme is upgraded. How do I add the customizations in the style.css to new child theme?
Thank you.
you should check your all files and folders of theme . sometime your theme has a dynamic css file like sass, less or other .... if you have a dynamic css file, you should customize that file ....
if you haven't dynamic css files, you can customize your main css file as you want.

How do I use new add_editor_style() function in wordPress?

I found this article:
http://www.deluxeblogtips.com/2010/05/editor-style-wordpress-30.html
I created a child theme using the Twentyten theme as a parent. I am trying to have the WYSIWYG editor use a custom stylesheet.
I added this to my functions.php file:
add_editor_style();
Then I created an editor-style.css file in my child theme's folder and added this:
html .mceContentBody {
max-width:591px;
}
When I go to the WYSIWYG editor and use firebug to check the css that is affecting the .mceContentBody element, I can see that is using my stylesheet, but it is being overrriden by the default editor-style.css sheet from the twentyten theme.
How can I force it to use my editor-style.css file and not the default one?
add_theme_support('editor_style');
before
add_editor_style('tinymce-styles.css');
assuming that your custom css is in your template's root folder.
Try redeclaring twentyten_setup in your theme's functions.php file. Just copy and paste the whole function from twentyten to your theme.
Check your CSS for errors. I spent hours pulling my hair out wondering why wordpress wasn't using my stylesheet. It wasn't even getting included. Turns out i had an extra { in my css.

Resources