Okay
  Public Ticket #2227415
FONT
Closed

Comments

  • ronanroesch started the conversation

    Hi, i want to use this font :

    Graphik Font Family

    How to use this font with your theme ? 

    Thanks

  •  1,284
    Bryan replied

    Hello

    I'm afraid that you have to custom theme code to import that font.

    You can add this code to functions.php file of child theme to add custom font if possible.

    // Add custom font to font select
    add_filter( 'kirki_fonts_standard_fonts', 'aeroland_child_add_custom_font' );
    function aeroland_child_add_custom_font( $fonts ) {   $fonts['poppinsvn'] = array(      'label'    => 'poppinsvn',      'variants' => array( 100, '100italic',  300, '300italic', 'regular', 'italic', 500, '500italic', 600, '600italic', 700, '700italic', 800, '800italic', 900, '900italic' ),      'stack'    => 'poppinsvn, sans-serif',   );   return $fonts;
    }
    // Enqueue custom font
    add_action( 'aeroland_enqueue_custom_font', 'aeroland_child_enqueue_custom_font' );
    function aeroland_child_enqueue_custom_font ( $font ) {   if( $font === 'poppinsvn' ) {       wp_enqueue_style( 'poppinsvn', get_stylesheet_directory_uri() . '/assets/fonts/poppinsvn/poppinsvn.css', null, null );   }
    }
    

    If you want to add other font, just use the same code and change the font name to apply. What do you mean the site is not working anymore? 

    Thanks


  • ronanroesch replied

    Ok, i want to use this font : https://www.cufonfonts.com/font/colfax

    so I added this modified code with the font chosen below. But nothing changes. Are there any other settings to make to activate this font?

    Thanks

    // Add custom font to font select
    add_filter( 'kirki_fonts_standard_fonts', 'aeroland_child_add_custom_font' );
    function aeroland_child_add_custom_font( $fonts ) {   $fonts['colfax'] = array(      'label'    => 'colfax',      'variants' => array( 100, '100italic',  300, '300italic', 'regular', 'italic', 500, '500italic', 600, '600italic', 700, '700italic', 800, '800italic', 900, '900italic' ),      'stack'    => 'colfax, sans-serif',   );   return $fonts;
    }
    // Enqueue custom font
    add_action( 'aeroland_enqueue_custom_font', 'aeroland_child_enqueue_custom_font' );
    function aeroland_child_enqueue_custom_font ( $font ) {   if( $font === 'colfax' ) {       wp_enqueue_style( 'colfax', get_stylesheet_directory_uri() . '/assets/fonts/colfax/colfax.css', null, null );   }
    }
  • ronanroesch replied

    to add info : 

    i have put this code in : customize > theme editor > functions.php

  •   ronanroesch replied privately
  • ronanroesch replied

    I saw in other help answers that you had to use the child theme. so I added, then redo the operation: 

    customize > theme editor aeroland child > functions.php

    (i have attached a screenshot) 

    and add this code : 

    // Add custom font to font select
    add_filter( 'kirki_fonts_standard_fonts', 'aeroland_child_add_custom_font' );
    function aeroland_child_add_custom_font( $fonts ) {   $fonts['colfax'] = array(      'label'    => 'colfax',      'variants' => array( 100, '100italic',  300, '300italic', 'regular', 'italic', 500, '500italic', 600, '600italic', 700, '700italic', 800, '800italic', 900, '900italic' ),      'stack'    => 'colfax, sans-serif',   );   return $fonts;
    }
    // Enqueue custom font
    add_action( 'aeroland_enqueue_custom_font', 'aeroland_child_enqueue_custom_font' );
    function aeroland_child_enqueue_custom_font ( $font ) {   if( $font === 'colfax' ) {       wp_enqueue_style( 'colfax', get_stylesheet_directory_uri() . '/assets/fonts/colfax/colfax.css', null, null );   }
    }

    BUT i have a error message : 

    Cannot redeclare aeroland_child_add_custom_font() (previously declared in /srv/htdocs/wp-content/themes/aeroland-child/functions.php:16)

    Can you help me, thanks.

    (in private message i have sent to you my credentials)

  •  1,284
    Bryan replied

    Hello

    Would you mind providing us with login credentials so we can take a closer look? 

    Thanks

  • ronanroesch replied

    you have credentials in private reply 

  •   ronanroesch replied privately
  • ronanroesch replied

    you can find credentials in private reply before 

  •  1,284
    Bryan replied

    Hello

    Thank for your details but i can not use it to access. 

    Can you check it again?

    Thanks

  •   ronanroesch replied privately
  • ronanroesch replied

    Hello,

    I just checked, and I'm sorry, yes the credentials was not good.

    Here are the good credentials. (I tested this one)

    You can find below, in privately reply ! :) 

    thanks

  •   Bryan replied privately