Search code examples
csswordpresswordpress-themingchild-theming

WP Child Theme's style.css working on one site but not on another


I created a child theme of the Wordpress rowling theme. My style.css contains this:

    /*
    Theme Name: MF2017
    Theme URI: 
    Description: rowling Child Theme
    Author: Kathrin Herwig
    Author URI: https://schriftbild.net
    Template: rowling
    Version: 1.0.0
    */

and the functions.php this:

    <?php
    /**
    * Enqueue scripts and styles.
    */
    function namescript_scripts() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
      wp_enqueue_style( 'child-style',
      get_stylesheet_directory_uri() . '/style.css',
      array('parent-style')
      );
    }
    add_action( 'wp_enqueue_scripts', 'namescript_scripts' );

     ?>

The child theme's css is loaded on my test-webspace , the class .grau: grey frame around the images is coming from the child theme's css). But not on the real website. (.grau is not loaded)

I tried everything, but cannot make it work.


Solution

  • It seems it has to do with access rights / file permissions: When I use the browser tools / styles and click on the child theme style.css, or when I click on the link to the CSS file in the source code, I get to see this:

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>403 Forbidden</title>
    </head><body>
    <h1>Forbidden</h1>
    <p>You don't have permission to access /wp-content/themes/MF2017/style.css
    on this server.</p>
    </body></html>
    

    So the browser is not allowed to load the styesheet. Check the access rights / file permissions of the file and its folder on that server and set it to public.