• Hello guys,

    Okay, i’ll make this quick. I have a my own custom made theme called “destinymaker”. And now I made a child theme for it and named it “destinymaker-child”.

    Now, I have to be able to edit my website’s style right? For example, I wanna change it’s background to black, and so I’ll use:

    body {background: #000;}

    but it doesn’t change. I’ve search around, and all of their problems have been resolved. Am I making any mistakes. Please enlighten me. Thanks.

    This is my child theme’s style.css

    /*
    Theme Name: destinymaker-child
    Theme URI: https://www.ads-software.com/
    Description: Child Theme for destinymaker
    Author: Destiny Maker
    Author URI: https://mywebsite.com/
    Template: destinymaker-child
    Version: 0.1
    */
    
    body{background:#000;}

    and this is its functions.php

    <?php
    
    add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
    function enqueue_parent_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
    }
    
    ?>

    P.S. do I need to write something similar to my parent’s stylesheet like the one on the child’s? /* (e.g. Theme Name: destinymaker) and so on.

    Edit:

    this is their locations:

    parent : wp-content/themes/destinymaker/style.css

    child : wp-content/themes/destinymaker-child/style.css

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter DestinyMaker

    (@destinymaker)

    About the Child theme’s header

    I wrote it wrong, the template is “destinymaker” without the quotes. but still no avail.

    Edit: And yes, I activated it. but it just load the child css destroying the theme because the parent’s css is not loaded

    Thread Starter DestinyMaker

    (@destinymaker)

    Okay Okay,

    I am really sleepy now, and I haven’t found an answer.. I do understand now things that are mostly complicated awhile ago..

    this is my child theme’s functions.php

    <?php
    
    // Faster than @import
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'destinymakercss', get_template_directory_uri() . '/style.css' );
    }
    
    ?>

    this is my child theme’s css (just a sample to test out if it works well)

    /*
     * Theme Name: Destiny Maker Child Theme
     * Template: destinymaker
    */
    
    ul.dropdown li * a:hover {
    /* Change color of links when hovered */
    background: #fff !important;
    color: #00ff00 !important;
    border-bottom: 1px solid #900;
    border-top: 1px solid #222;
    }

    I activated my child theme. And nothing happened after activating it. When viewing the source code of my page, I can see the child theme’s css there.(ofc because of <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">) which activates my child theme’s stylesheet(activated). And I also see my parents stylesheet there (https://mywebsite.com/wp-content/themes/destinymaker/style.css?ver=4.2.4) because it is enqueued right? but still, I still have no good results.

    Please and thank you.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Okay, i’ll make this quick. I have a my own custom made theme called “destinymaker”. And now I made a child theme for it and named it “destinymaker-child”.

    If it’s your own custom theme then why are you bothering with a child theme? It’s all custom and child themes are to protect users from when your parent theme is updated.

    In your case, will that happen?

    Thread Starter DestinyMaker

    (@destinymaker)

    Yes sorry about that, I didn’t made it clear. I am currently studying it, and to make my own theme to submit for others to use “for now my friends who is asking for it”. But that destinymaker is just a test run for me, so I want to make sure that I am doing it right, but since this is now on my way, I can’t make any progress.

    I hope I explained it well, English is not my native language. Thank you btw for the response.

    Can you check if your child theme’s style.css is loading after the parent theme’s stylesheet? I understand that using @import to import your parent theme’s CSS to child theme is not the recommended way, but you could still try it and see if that works.

    And if you use Jetpack, you can activate the Custom CSS module and you can edit CSS without needing to create a child theme.

    Thread Starter DestinyMaker

    (@destinymaker)

    When I view the source. My child theme’s style.css is on before the parent’s stylesheet. I know, to overwrite it, it has to be after so what I did is I put <link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_url’); ?>”> where it should appear after the parent theme’s stylesheet. And same result though.

    Note: It has no plugin yet. That’s why I’m having a hard time figuring why xD

    Jetpack, I’ve never used it. But I will take note of this one

    Thread Starter DestinyMaker

    (@destinymaker)

    Okay, this is what happens.

    <link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_url’); ?>”> = child theme’s stylesheet is under the css of the parent theme. And this is what’s happening..

    1.) The child theme’s stylesheet is now loading, great right?
    2.) The parent theme’s stylesheet is not loading, ??
    3.) Though not loading, you can see the parent theme’s stylesheet inside when you view the source (even when clicking it, it shows the codes inside parent-theme/style.css)

    It’s like the “child theme stylesheet” is the “parent theme stylesheet” and not loading the actual parent theme at all…

    I think I explained it now well xD

    Edit:

    4.) When I activate the parent theme, of course it loads the parent theme stylesheet, and the child is not at all.
    5.) But when the child theme is activated, it’s like it doesn’t have a parent at all.

    Thread Starter DestinyMaker

    (@destinymaker)

    Still, no progress.

    I tried using this on my child theme functions.php

    <?php
    
    // Faster than @import
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'destinymakerparent', get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'destinymakerchild', get_stylesheet_directory_uri() . '/style.css' );
    }
    
    ?>

    and when I view the source:

    <link rel='stylesheet' id='destinymakerparent-css'  href='https://MYWEBSITE.EXT/wp-content/themes/destinymaker/style.css?ver=4.2.4' type='text/css' media='all' />
    <link rel='stylesheet' id='destinymakerchild-css'  href='https://MYWEBSITE.EXT/wp-content/themes/destinymaker-child/style.css?ver=4.2.4' type='text/css' media='all' />

    Note: “MYWEBSITE.EXT” is just a sample.

    The outcome is that the child theme’s stylesheet loads after the parent theme’s stylesheet to overwrite the other one. But.. the result is still the same:

    The child theme's CSS loads but the parent doesn't load

    only the child’s CSS appears, not a single CSS from parent’s CSS loads/executed.

    I appreciate help, Thanks.

    I have no knowledge of PHP, so please excuse if you’ve already tried this. The Codex page on child themes recommends this :

    function theme_enqueue_styles() {
    
        $parent_style = 'parent-style';
    
        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', 'theme_enqueue_styles' );

    Using ‘parent-style’ as a dependency makes sure the child theme’s style.css loads after the parent theme’s style.css. It seems like you’re not using the parent-style and child-style dependencies. Could you check if this works?

    Thread Starter DestinyMaker

    (@destinymaker)

    Thanks for replying, though I already tried it.

    The only problem i got is that the parent itself is not loading. Anyways I’m trying a different approach every now and then.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Child theme not making any progress’ is closed to new replies.