Support » Theme: Highwind » Remove Open Sans and add custom fonts

  • Resolved AJ

    (@permaculturetreegeek)


    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.
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • 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.

    Bests!!

    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');
    endif;

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove Open Sans and add custom fonts’ is closed to new replies.