A
A
Alexander2016-03-29 12:03:13
WordPress
Alexander, 2016-03-29 12:03:13

How to include styles from a parent WordPress theme?

Decided to make a child theme based on the indreams theme. I did all the first steps to create a child theme:
1. Created a folder with the name of the child theme "indreams-child".
2. Added a style.css file with the following content in it

/*
Theme Name: Дочерняя тема indreams
Template: indreams
*/

// импортируем стили родительской темы
@import url("../indreams/style.css");

// Свои дополнительные стили
.foo{ color:red; }

The theme, according to the idea, should already work. But when I activate it and open it, the layout crashes!
I read in one of the articles on the Internet that you need to create a function.php file in the same folder and include parent styles in it. I did it like this:
function indreams_child_enqueue_styles() {
    wp_enqueue_style( 'style-name', get_stylesheet_uri() );	
  wp_enqueue_style( 'indreams-Arvo', indreams_font_url(), array(), null );
  wp_enqueue_style('indreams-flexslider-css', get_template_directory_uri() . '/css/flexslider.css');
    wp_enqueue_style('indreams-font-awesome-css', get_template_directory_uri() . '/css/font-awesome.css');
  wp_enqueue_style('indreams-bootstrap-css', get_template_directory_uri() . '/css/bootstrap.css');
  wp_enqueue_style('indreams-superfish-css', get_template_directory_uri() . '/css/superfish.css');
  wp_enqueue_style('indreams-animate-css', get_template_directory_uri() . '/css/animate.css');
  wp_enqueue_style('indreams-prettyPhoto-css', get_template_directory_uri() . '/css/prettyPhoto.css');
  wp_enqueue_style('indreams-meanmenu-css', get_template_directory_uri() . '/css/meanmenu.css');  
    }
  add_action( 'wp_enqueue_scripts', 'indreams_child_enqueue_styles' );

Nothing works again. Please, help. Tell me what the problem is
Note: Exactly the same problem in other topics. The problem disappears when I copy the entire head tag generated in the parent theme to my child theme.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander, 2016-03-29
@Dredder

The error was that I named the functions.php file incorrectly!
Function.php instead of functions.php
Thank you all for your replies

M
Mr Crabbz, 2016-03-29
@Punkie

https://youtu.be/W3XOzN9Q9ww?t=8m43s - rewinded to 8:43. Did the same - everything works.

M
MikewILL, 2016-04-03
@MikewILL

Thanks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question