Support » Theme: Moesia » Child theme and fonts not working

  • Resolved gmsiegel

    (@gmsiegel)


    I created a child theme so that I can update the original without losing any customizations. However, the fonts aren’t working- they only show a default sans-serif font, and won’t let me change to the list of Google fonts shown in the Customize menu.

    Any ideas? Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Have you tried deactivating all plugins to see if it may conflict with the theme?

    Thread Starter gmsiegel

    (@gmsiegel)

    I just deactivated all plug-ins- no change. I cannot change any of the fonts in the child theme.

    Here’s the URL:
    http://test.localgeek.us

    I’m not importing the parent theme’s css into the child’s style.css. I’m using the WP recommended method to load it with the child’s functions.php file instead.

    [code]

    <?php
    
    add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles', PHP_INT_MAX);
    function enqueue_child_theme_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
        wp_enqueue_style( 'child-style', get_stylesheet_uri(), array('parent-style')  );
    }

    Have another look at the Codex. The code you have is wrong and it was changed, you need to use it like this:

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

    I tested just now and it’s working

    We’re using wp_add_inline_style to add customizations (fonts, colors etc.) and the code you’re using now has a higher priority (PHP_INT_MAX) and it messes things up.

    Thread Starter gmsiegel

    (@gmsiegel)

    Fantastic! That worked.
    Should I use that new functions.php code from now on for all child themes, or just this one?

    Thanks again.

    For all child themes. There’s nothing special here. That’s why I linked to the Codex page for child themes, the code you were using was replaced by the code I posted, which I also took from the Codex page.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Child theme and fonts not working’ is closed to new replies.