• Resolved eight17

    (@eight17)


    Hello,

    Curious where (which file) the Open Sans font is imported?

    What needs to be done to either use a different google font and have that as default for all elements… or remove the google fonts completely and just change the default font family for all elements?

    Seems simple enough but I’m falling short here.

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Theme Author ThemeAWESOME

    (@tsquez)

    Hey there,

    Open Sans is added via functions.php starting on line 207. The font is added with a function which is the proper way.

    The way you change the font is to remove the function with your own function then add your function include the google font you want.

    Here is how you remove the open sans font. In your child theme add the following:

    function remove_wpforge_fonts() {
        remove_action( 'wp_enqueue_scripts', 'wpforge_google_fonts', 0 );
    }
    add_action( 'after_setup_theme', 'remove_wpforge_fonts', 9 );

    and right after that you add your own function like this:

    if ( ! function_exists( 'add_my_fonts' ) ) {
    	function add_my_fonts() {
    	    wp_enqueue_style('indieflower', '//fonts.googleapis.com/css?family=Indie+Flower);
    	}
    	add_action( 'wp_enqueue_scripts', 'add_my_fonts', 0);
    }

    now of you want to add multiple fonts then you would do this:

    if ( ! function_exists( 'add_my_fonts' ) ) {
    	function add_my_fonts() {
    	    wp_enqueue_style('indieflower', '//fonts.googleapis.com/css?family=Indie+Flower');
                wp_enqueue_style('roboto', '//fonts.googleapis.com/css?family=Roboto');
                wp_enqueue_style('lobster', '//fonts.googleapis.com/css?family=Lobster');
    	}
    	add_action( 'wp_enqueue_scripts', 'add_my_fonts', 0);
    }

    then you change the font family in your child theme style sheet. Don’t forget if you use WP-Forge, leave a review. Thanks and as always enjoy!

    Thread Starter eight17

    (@eight17)

    Perfect, this works… thanks for taking a look!

    Just one correction for anyone else looking at this. There was a missing ‘ after the Google font URL. Should look like this:

    if ( ! function_exists( 'add_my_fonts' ) ) {
    	function add_my_fonts() {
    	    wp_enqueue_style('indieflower', '//fonts.googleapis.com/css?family=Indie+Flower');
    	}
    	add_action( 'wp_enqueue_scripts', 'add_my_fonts', 0);
    }
    Theme Author ThemeAWESOME

    (@tsquez)

    Yep you are correct…ooops

    Hello

    i have try this but the function add_my_fonts is missing in the file functions.php (wp forge)

    please help me to change the font

    when i logged in then the blog show a other font when i logged out ?

    Theme Author ThemeAWESOME

    (@tsquez)

    Hi Stan74,

    What you need to do is add the above to your functions.php file. Its not their automatically. You have to copy and paste the following:

    if ( ! function_exists( 'add_my_fonts' ) ) {
    	function add_my_fonts() {
    	    wp_enqueue_style('indieflower', '//fonts.googleapis.com/css?family=Indie+Flower');
    	}
    	add_action( 'wp_enqueue_scripts', 'add_my_fonts', 0);
    }

    into functions.php,

    then change

    //fonts.googleapis.com/css?family=Indie+Flower

    to the font you want to use.

    Hops this helps.

    Thank you, it is working perfect

    Theme Author ThemeAWESOME

    (@tsquez)

    Glad yo got it working. If you like the theme please leave a trading and review. As always, enjoy!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Change Font’ is closed to new replies.