WordPress.org

Ready to get started?Download WordPress

Forums

Decode
[resolved] Problems creating child theme (17 posts)

  1. sanomi78
    Member
    Posted 6 months ago #

    Great theme!

    My problem:

    I am trying to create a child theme of Decode so i can implement some changes. I used the guide on http://codex.wordpress.org/Child_Themes to create one.

    My problem is: the child theme doesn't seem to inherit the parents CSS and has no 'style' at all.

    The style.css i use in my decode-child map:

    /*
    Theme Name: Decode Child
    Theme URI: http://scotthsmith.com/projects/decode/
    Description: Decode Theme
    Author: Edwin van Thillo
    Author URI: http://www.vanthillo.eu
    Template: decode
    Version: 1.0.0
    */

    @import url("../decode/style.css");

    /* =Theme customization starts here
    -------------------------------------------------------------- */

    Can you help me?

  2. Scott Smith
    Member
    Theme Author

    Posted 6 months ago #

    I buggered this up in the latest release. It's fixed in the next one. For now, you can wait it out until the update it live. (Follow me on Twitter or App.net and I'll tweet when there's an update)

    Or, you can download the update from GitHub.

  3. sanomi78
    Member
    Posted 6 months ago #

    Tnx!

  4. Steven Jay Cohen
    Member
    Posted 6 months ago #

    Also having the Child Theme issue.

    Until 2.8.4 its the WordPress update server, I moved my child theme CSS into the JetPack CSS add-on.

    Scott, would you recommend using CSS import for Google Fonts or adding that to the functions.php in the child theme?

  5. sanomi78
    Member
    Posted 6 months ago #

    I used the Github download and now everything is ok. Can't help you with the Google Fonts question though, Steven. Hope Scott has a good suggestion.

  6. Scott Smith
    Member
    Theme Author

    Posted 6 months ago #

    Are you saying that your child theme isn't using the Decode font from Google fonts? If you want to add a different font, it is better to dequeue the original font in your child there's functions.php file then enquque the one you want. But first, use 2.8.4.

  7. Brett_the_Librarian
    Member
    Posted 6 months ago #

    I ran into this problem as well, but was able to make a child theme using 2.8.4. Thanks for posting this fix.

    But, like Steven, I'm confusing about changing the fonts. Every time I mess with functions.php, I take down my site. Scott, could you provide some more explicit instructions on changing fonts. My goal is to use a Google Font for headers and a different Google Font for body text. I've been working at it for hours and getting nowhere.

  8. Scott Smith
    Member
    Theme Author

    Posted 6 months ago #

    Ok, share what you have done to try to change the Google Fonts. I can share my Child Theme code to change the Google Font, because I do this myself on my blog.

  9. Steven Jay Cohen
    Member
    Posted 6 months ago #

    <?php
        function load_fonts() {
          wp_enqueue_style('googleFonts', 'http://fonts.googleapis.com/css?family=Rock+Salt|Oxygen+Mono');
        }
    
        add_action('wp_enqueue_scripts', 'load_fonts');
    
    function my_updated_copyright($first_year, $owner) {
      $copyright_notice = '&copy; ' . $first_year;
      $current_year = date('Y');
      if($first_year != $current_year) {
        $copyright_notice .= ' - ' . $current_year;
      }
      $copyright_notice = $owner.' '.$copyright_notice;
      return $copyright_notice;
    }
    
    ?>

    This is my ENTIRE functions.php

    Look at my functions load_fonts()

    In it, I am ADDING two Google fonts to the site (Rock Salt and Oxygen Mono).
    I like Decode's Oxygen as a default font. But, I like displaying block quotes and code in Monospaced fonts (Oxygen Mono gives me that). And, I like my headings in something other than Oxygen.

    The second function is how I generate part of the footer on my site:

    Aside from those changes, my site is running pure Decode :)

  10. Scott Smith
    Member
    Theme Author

    Posted 6 months ago #

    OK, I checked out your site, but it's all looking good. What is wrong with it?

    Here's what I do (using TypeKit) it might not be much help, but I thought I'd share it for what it's worth.

    function decode_remove_styles() {
    	wp_dequeue_style( 'decode-font-stylesheet' );
    
    }
    add_action( 'wp_enqueue_scripts', 'decode_remove_styles', 20 );
    
    function decode_add_typekit() {
    
            echo '<script type="text/javascript" src="//use.typekit.net/olq0xkh.js"></script>
    <script type="text/javascript">try{Typekit.load();}catch(e){}</script>';
    
    }
    add_filter( 'wp_head', 'decode_add_typekit' );
  11. Steven Jay Cohen
    Member
    Posted 6 months ago #

    Sorry Scott,

    Nothing is wrong with mine :)

    I was offering my functions.php for Brett to see how its done.

  12. Scott Smith
    Member
    Theme Author

    Posted 6 months ago #

    Oh sorry my bad.

    Yeah, I'll just add that if you aren't going to use the Oxygen font then you should dequeue it so it isn't loaded on the page. I know you are going to use it, Steven, but for anyone else...

  13. Brett_the_Librarian
    Member
    Posted 6 months ago #

    Thanks, Steven and Scott, for your help -- and for responding so quickly and so clearly. For others, just in case the above doesn't make sense to you, here's the code I'm using to dequeue Oxygen and add the two Google fonts I'm using (in this case Merriweather and Merriweather Sans):

    <?php
    	function decode_remove_styles() {
    		wp_dequeue_style( 'decode-font-stylesheet' );
    	}
    
    	function load_fonts() {
          wp_enqueue_style('googleFonts', 'http://fonts.googleapis.com/css?family=Merriweather+Sans|Merriweather');
        }
    
        add_action('wp_enqueue_scripts', 'load_fonts');
    
    	?>
  14. Armoros
    Member
    Posted 6 months ago #

    I just saw the above post, but i didn't dequeue the Oxygen font or something else, and my theme works great. I just use this in my Functions.php:

    <?php
        function load_fonts() {
          wp_enqueue_style('googleFonts', 'http://fonts.googleapis.com/css?family=Noto+Sans&subset=latin,greek');
        }
    
        add_action('wp_enqueue_scripts', 'load_fonts');
    
    ?>

    And this in my Style.css:

    body,
    button,
    select,
    textarea {
    	font: 400 87.5%/1.5 Noto Sans, Verdana, Arial;
    }

    Is that OK? or I must dequeue also the Oxygen font and do what Brett done?
    Thank you

  15. Steven Jay Cohen
    Member
    Posted 6 months ago #

    Dequeue-ing an unused font is a good idea. No reason to have something that you aren't using loaded. Remember, JavaScript is single threaded. This means, like Windows 3.11 or Mac OS 6.0.7, it can only work on 1 thing at a time.

    Since JavaScript is used for all the fancy things that WordPress can do, turning off unused plugins, or removing unused styling , that is dynamically loaded, can only improve performance on your site.

  16. Armoros
    Member
    Posted 6 months ago #

    Thank you Steven for your help, i will do this since is a good idea.
    Is this line enough to put in Functions.php

    function decode_remove_styles() {
    		wp_dequeue_style( 'decode-font-stylesheet' );
    	}

    Should i add somewhere on the above lines, the font Oxygen.
    Thank you

  17. Scott Smith
    Member
    Theme Author

    Posted 6 months ago #

    Steven, I couldn't have said it better myself. Thanks for adding that.

Reply

You must log in to post.

About this Theme

About this Topic