---
title: "Problems with the child theme’s stylesheet?"
description: "When we create a child theme from the main theme we have chosen to build our website under WordPress, we normally only need three files: screenshot.jpg: this is a 600×450 pixel JPG image that will be the image of our"
url: https://artprojectgroup.com/problems-with-the-child-theme-stylesheet
date: 2015-11-25
modified: 2023-02-11
author: "Art Project Group"
image: https://artprojectgroup.com/wp-content/uploads/2023/02/wordpress-blog.webp
categories: ["Tutorials"]
tags: ["CSS", "functions.php", "PHP", "style.css", "WordPress"]
type: post
lang: en-US
---

# Problems with the child theme’s stylesheet?

When we create a child theme from the main theme we have chosen to build our website under WordPress, we normally only need three files:

1. *screenshot.jpg*: this is a 600×450 pixel JPG image that will be the image of our child theme. At **APG** we always use our own logo in our customisations, so you can put whichever image you like best.
2. *functions.php*: we have talked about this file countless times and it is the one that lets us add customised PHP code.
3. *style.css*: this is the stylesheet where we put the customised CSS code we need to build the website.

### Problem

Specifically, the problem we are facing today will show us our website with no stylesheet, practically the same as the way the Google spider sees it, so it will only show text and images with no layout of any kind.

This problem occurs in some themes in which the standard way of loading the parent theme’s stylesheet does not work.

We remind you that the usual way of loading the parent theme’s stylesheet is to add a simple line of code in the *style.css* file of the child theme, specifically one like this:

Copy to clipboardSyntax Highlighter@import url(../tema-padre/style.css);

### Solution

Well then, to solve this problem, which can give us more than one headache, the solution is really simple.

To do it we are going to disregard the previous code, since it is not going to produce any kind of positive result, and we are going to create a new PHP function in the *functions.php* file of the child theme, specifically this one:

Copy to clipboardSyntax Highlighterfunction apg_hoja_de_estilo() {
wp_enqueue_style( 'apg-css', get_stylesheet_directory_uri() . '/style.css' );
}
add_action( 'wp_enqueue_scripts', 'apg_hoja_de_estilo' );
Thanks to this simple PHP function we will have solved the problem and we will see our website again just as we expected, well laid out and structured.

We hope this small piece of code gets you out of more than one tight spot and that you find it useful.
