The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] Remove Open Sans and add custom fonts (3 posts)

  1. AJ
    Posted 2 years ago #

    Just in case anyone else wants to remove Open Sans and add their own typography into the theme.

    Add the following in Functions.php:

    // remove Open Sans font
    add_action( 'wp_enqueue_scripts', 'my_deregister_styles', 100 );
    function my_deregister_styles() {
    	wp_deregister_style( 'open-sans' );
    // add custom fonts
    add_action( 'wp_enqueue_scripts','highwind_add_myfonts');	
    function highwind_add_myfonts() {
    wp_enqueue_style( 'my-fonts', 'http://fonts.googleapis.com/css?family=Roboto|Roboto+Condensed|Alegreya:700' );
     //add your own fonts here.
  2. pabagan
    Posted 2 years ago #

    Thanks AJ. I tried that function and remove Open Sans stylesheet but also breaks styles from WP Top-bar admin.

    Very dissapointed for the default Open Sans loading!!

    This here worked for me.


  3. AJD
    Posted 2 years ago #

    That is strange. It is working fine on one site, but not on another.
    Thanks for the solution, I'm going to paste it here:

    // Remove Open Sans that WP adds from frontend
    if (!function_exists('remove_wp_open_sans')) :
    function remove_wp_open_sans() {
    wp_deregister_style( 'open-sans' );
    wp_register_style( 'open-sans', false );
    add_action('wp_enqueue_scripts', 'remove_wp_open_sans');
    // Uncomment below to remove from admin
    // add_action('admin_enqueue_scripts', 'remove_wp_open_sans');

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic