WordPress.org

Ready to get started?Download WordPress

Forums

Fluxipress
[resolved] [closed] How to change font using a child theme? (14 posts)

  1. Anton Johansson
    Member
    Posted 11 months ago #

    Hi Michael Kloepzig,

    Thanks for a great theme. I'm trying to personalize my site using a child theme to Fluxipress. Please can you help me with the code snippet I need to place in my child theme's function.php to be able to use a different google font then Open Sans? Have tried to dequeue the styles added in Fluxipress and added my own, but I can't get it to work.

    Thanks in advance!

  2. Andrew
    Forum Moderator
    Posted 11 months ago #

    To which font specifically?

  3. Anton Johansson
    Member
    Posted 11 months ago #

    PT Sans and PT Sans Narrow for headers.

  4. Andrew
    Forum Moderator
    Posted 11 months ago #

    Do you have that font? In which file type(s)?

  5. Anton Johansson
    Member
    Posted 11 months ago #

    My plan was to load them from Google in these styles:

    http://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700,700italic|PT+Sans+Narrow:400

  6. Andrew
    Forum Moderator
    Posted 11 months ago #

    Let's see your site with the Child Theme activated .

  7. Anton Johansson
    Member
    Posted 11 months ago #

    Unfortunately it's not on a public server right now. However here is the code that I have in my functions.php.

    <?php
    
    // Child theme
    
    function child_dequeue_fonts() {
    	wp_dequeue_style('fluxpiress-css-fonts');
    }
    add_action('wp_enqueue_scripts', 'child_dequeue_fonts', 11);
    
    function child_fonts() {
    	wp_register_style(
    		'child-css-fonts',
    		'http' . ($_SERVER['SERVER_PORT'] == 443 ? 's' : '') . '://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700,700italic|PT+Sans+Narrow:400'
    	);
    	wp_enqueue_style('child-css-fonts');
    }
    add_action('wp_enqueue_scripts', 'child_fonts');
    
    ?>

    And here is the code from the parent theme I'm trying to change:

    // Parent theme Fluxipress 1.04 excerpt
    
    function fluxipress_add_stylesheets()
    {
    	wp_register_style(
    		'fluxpiress-css-magnific',
    		get_template_directory_uri() . '/css/magnific-popup.css'
    	);
    	wp_enqueue_style('fluxpiress-css-magnific');
    
    	wp_register_style(
    		'fluxpiress-css-fonts',
    		'http' . ($_SERVER['SERVER_PORT'] == 443 ? 's' : '') . '://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,700,300'
    	);
    	wp_enqueue_style('fluxpiress-css-fonts');
    }
    add_action('wp_enqueue_scripts', 'fluxipress_add_stylesheets');

    Note that "fluxipress" is misspelled in the parent theme - "fluxpiress". Therefor I uesd the same spelling in the child theme.

  8. Andrew
    Forum Moderator
    Posted 11 months ago #

    What's in your style.css file?

  9. Anton Johansson
    Member
    Posted 11 months ago #

    /* Style excerpt */
    
    @import url("../fluxipress/style.css");
    
    body, #commentform #submit, input[type=text], textarea {
    	font-family: 'PT Sans', sans-serif;
    }

    Haven't got around to style PT Sans Narrow yet...

  10. Michael Kloepzig
    Member
    Theme Author

    Posted 10 months ago #

    Just a heads-up: The misspelling of "fluxipress" will be fixed in 1.0.5 - you'll have to change it in your child theme accordingly.

  11. adsleeblythe
    Member
    Posted 9 months ago #

    Michael, can you tell me what I need to do to make this child theme work!? You mentioned there is a spelling mistake of 'fluxipress' and i need to change my child theme accordingly..do I just have to change the template name in style.css to:

    Template: fluxpiress

    ???
    I used the find and replace tool in dreamweaver to find 'fluxpiress' in parent folder (fluxipress) and it found 8 instances of it in functions.php. I replaced 'fluxpiress' with 'fluxipress' saved it then uploaded it to my server and it is still not reading my child style.css! ahhhhhh!

    Help please. Thank you

  12. Michael Kloepzig
    Member
    Theme Author

    Posted 9 months ago #

    As I said in the other thread, the typos are unlikely to affect your child theme. Please send a zip with your child theme so i can investigate what causes the problems.

  13. adsleeblythe
    Member
    Posted 9 months ago #

    Thanks, have sent you a link to my child theme in other thread.

  14. WPyogi
    Volunteer Moderator
    Posted 9 months ago #

    Closing this thread - please don't post in other people's threads or post the same question in more than one place - it causes much confusion for people helping out here.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic