I am using Enough theme and i want to create a child theme the way suggested in codex i.e. using wp_enqueue_style. I am doing it the way it's explained but left margin more now like it's indented to right. Seems to me some stylesheet loading problem.
I have created style.css and functions.php in child theme folder. In parent theme folder there is 1 style.css file and 11 css file inside '/css' directory.
I have tried lot of things but not able to do it correctly. Below is how i am trying to load parent theme style sheets.
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'styles', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'styles', get_template_directory_uri() . '/css/admin-options.css' );
wp_enqueue_style( 'styles', get_template_directory_uri() . '/css/base.css' );
wp_enqueue_style( 'styles', get_template_directory_uri() . '/css/colors.css' );
wp_enqueue_style( 'styles', get_template_directory_uri() . '/css/box-modules.css' );
wp_enqueue_style( 'styles', get_template_directory_uri() . '/css/approach.css' );
wp_enqueue_style( 'styles', get_template_directory_uri() . '/css/comment.css' );
wp_enqueue_style( 'styles', get_template_directory_uri() . '/css/fonts.css' );
wp_enqueue_style( 'styles', get_template_directory_uri() . '/css/layout-fluid.css' );
wp_enqueue_style( 'styles', get_template_directory_uri() . '/css/normalize.css' );
wp_enqueue_style( 'styles', get_template_directory_uri() . '/css/post-format.css' );
wp_enqueue_style( 'styles', get_template_directory_uri() . '/css/ua.css' );
}
?>
I am using 'style' as first parameter because in the functions.php in parent theme i.i Enough i have following code, (I have put a line with arrow ------------> in front of the the code line) -
/**
*
*
*/
if ( !function_exists( "enough_enqueue_scripts_styles" ) ) {
function enough_enqueue_scripts_styles() {
global $is_IE, $enough_version;
$enough_csses = array( "css/normalize.css", "genericons/genericons.css", "css/fonts.css", "css/box-modules.css", "css/comment.css", "css/ua.css", "css/colors.css", "css/base.css", "css/layout-fluid.css", "css/post-format.css", "css/approach.css" );
foreach ( $enough_csses as $ecnough_css_path ) {
if ( file_exists( trailingslashit( get_stylesheet_directory() ) . $ecnough_css_path ) ) {
wp_enqueue_style( 'enough_' . basename( $ecnough_css_path, '.css' ), trailingslashit( get_stylesheet_directory_uri() ) . $ecnough_css_path, array(), $enough_version );
} else {
wp_enqueue_style( 'enough_' . basename( $ecnough_css_path, '.css' ), trailingslashit( get_template_directory_uri() ) . $ecnough_css_path, array(), $enough_version );
}
}
----------->wp_enqueue_style( 'styles', get_stylesheet_uri(), array( 'enough_approach' ), $enough_version );
$gallery_style = enough_gallerys_css();
wp_add_inline_style( 'styles', $gallery_style );
wp_enqueue_style( 'enough-web-font', apply_filters( 'enough_web_font', '//fonts.googleapis.com/css?family=Ubuntu:400,700' ) );
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'comment-reply' );
if ( $is_IE ) {
wp_register_script( 'html5shiv', get_template_directory_uri() . '/inc/html5shiv.js', array(), '3', false );
wp_enqueue_script( 'html5shiv' );
}
}
}
Do i need to create all css files in child themes ? or I can have only 1 css file namely style.css in child theme ? What would be the correct way of doing this ?
Edited this way
<?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' );
wp_enqueue_style( 'style1', get_template_directory_uri() . '/css/admin-options.css' );
wp_enqueue_style( 'style2', get_template_directory_uri() . '/css/base.css' );
wp_enqueue_style( 'style3', get_template_directory_uri() . '/css/colors.css' );
wp_enqueue_style( 'style4', get_template_directory_uri() . '/css/box-modules.css' );
wp_enqueue_style( 'style5', get_template_directory_uri() . '/css/approach.css' );
wp_enqueue_style( 'style6', get_template_directory_uri() . '/css/comment.css' );
wp_enqueue_style( 'style7', get_template_directory_uri() . '/css/fonts.css' );
wp_enqueue_style( 'style8', get_template_directory_uri() . '/css/layout-fluid.css' );
wp_enqueue_style( 'style9', get_template_directory_uri() . '/css/normalize.css' );
wp_enqueue_style( 'style10', get_template_directory_uri() . '/css/post-format.css' );
wp_enqueue_style( 'style11', get_template_directory_uri() . '/css/ua.css' );
}
?>
And here is style.css in child theme
/*
Theme Name: Enough Child
Theme URI: http://www.tenman.info/wp3/enough/
Description: Satisfied enough necessary minimum structure Responsive Theme. HTML5 , Supports Post Format Archives , You can select your favorite Post Format
Author: Tenman
Author URI: http://www.tenman.info/wp3/
Version: 1.22
Tags: two-columns,custom-colors, custom-header, custom-background, custom-menu, editor-style, threaded-comments, sticky-post, flexible-header
Template: enough
Text Domain: enough-child
License: GNU General Public License v2.0
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
The images _