• Resolved thad88

    (@thad88)


    This is my first time using WordPress. I’m using the free premium theme Malaka on shared hosting at HostGator. I’ve added some pictures and customized the site a bit, but there are a few things in the layout that I don’t like, so I created the child theme to make my changes.

    It appears that I created the child correctly since it shows up on the themes page, though it is displayed as an empty square while the other themes have an image “thumbnail.” Is that normal?

    Do I want to activate the child theme or leave the original Malaka theme as active? When I activate the child theme, the color of the headers and some of the text change back to the original WordPress install colors. Shouldn’t the child theme inherit these colors from the parent theme? That’s what makes me think that things aren’t setup properly.

    Here is the code at the top of my parent theme CSS:

    Theme Name: Malaka
    Theme URL: https://www.fabthemes.com/malaka/
    Author: Fabthemes.com
    Author URI: https://fabthemes.com/
    Version: 1.0
    License: GNU General Public License
    License URI: license.txt
    Text Domain: fabthemes
    Domain Path: /languages/
    Tags:

    Here is the code at the top of my child theme CSS:

    Theme Name: Malaka Child
    Theme URL: https://www.fabthemes.com/malaka/
    Author: Fabthemes.com
    Author URI: https://fabthemes.com/
    Template: Malaka
    Version: 1.0
    License: GNU General Public License
    License URI: license.txt
    Text Domain: fabthemes
    Domain Path: /languages/
    Tags:

    Here is my functions.php:

    <?php
    
    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' );
    
    ?>

    Does everything look OK? I’ve been reading forums and documentation on child themes for the past 2 days, but being so new to WordPress, some of it just doesn’t make sense to me.

    Thad

Viewing 6 replies - 1 through 6 (of 6 total)
  • stephencottontail

    (@stephencottontail)

    It appears that I created the child correctly since it shows up on the themes page, though it is displayed as an empty square while the other themes have an image “thumbnail.” Is that normal?

    The thumbnail display comes from a file named screenshot.png in the child theme’s folder.

    When I activate the child theme, the color of the headers and some of the text change back to the original WordPress install colors. Shouldn’t the child theme inherit these colors from the parent theme? That’s what makes me think that things aren’t setup properly.

    Does your theme have options to change the header and text colors? Those don’t carry over, unfortunately; WordPress considers the child theme to be separate from the parent theme and settings like widgets and menus don’t carry over.

    Thread Starter thad88

    (@thad88)

    Thank you for your reply, Stephen. I’ll add a screenshot for my child theme.

    I believe I have the option to change header, font, etc colors in my theme. If not, I imagine it can be done via CSS. That just doesn’t sound right though. If the purpose of a child theme is to override settings in the parent theme, if I don’t make changes to it, it should remain what it was in the parent theme, no? Aren’t the colors of those items assigned in the style sheet? My functions.php is supposed to import the styles from the parent. It doesn’t appear that they are being imported. Is my functions.php code correct?

    stephencottontail

    (@stephencottontail)

    if I don’t make changes to it, it should remain what it was in the parent theme, no? Aren’t the colors of those items assigned in the style sheet?

    Not necessarily. Themes can offer settings to change the text fonts, colors, etc., and those settings would then get written to the database. Later, the theme would pull those settings from the database to change how text is displayed, falling back to the stylesheet only if the user hasn’t set a specific font/color/etc. WordPress considers the child theme to be a different theme from the parent theme, though, and by default WP won’t pull those settings from a different theme.

    As I’m not familiar with your theme, I can’t say for sure whether that’s the case, though. Have you asked your theme’s vendor for more information?

    Thread Starter thad88

    (@thad88)

    Good explanation. Things are starting to make more sense.

    I assumed (and we all know where that will get you :] ) that when making color changes, etc in the dashboard, those changes get written to the CSS. Apparently that’s not the case, as you’ve mentioned, because searching through the CSS, I can’t find those color settings anywhere.

    No, I have not contacted the vendor. I like to troubleshoot things and figure out what’s going on. Support for free products is usually lacking, but I’ll contact them if it comes down to it. I like to tinker with things. ??

    Does WordPress give me direct access to the database or is that something that the individual theme would have to allow? I’m not much of a back-end guy, but I did take a PHP class. Just wondering if I could tweak those things myself.

    Thread Starter thad88

    (@thad88)

    Thanks for the help, Stephen.

    stephencottontail

    (@stephencottontail)

    Sorry I missed your previous reply.

    Does WordPress give me direct access to the database or is that something that the individual theme would have to allow? I’m not much of a back-end guy, but I did take a PHP class. Just wondering if I could tweak those things myself.

    WordPress provides a few functions that let you read from and write to the database, but if you know MySQL and something like PhpMyAdmin or any number of other apps that can interact with a MySQL database, that’s the best way to poke around the database. You’ll probably have to speak with your hosting provider to get access. Make sure to create a backup of the database, just in case.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Child theme not inheriting parent theme’ is closed to new replies.