MinimogWP Documentation
  • Getting Started
    • Welcome to MinimogWP
    • Theme requirements 🔥
    • WordPress knowledge base
  • Support
    • My purchase code
    • How to get support
  • Installation
    • How to install demo
    • Best Elementor Settings
    • Common Installation Issues
  • Update
    • Before Updating
    • Update Theme
    • Optimize theme
  • Build Your Site
    • WordPress configuration
    • Theme Options
    • General Settings
    • Build with Elementor
  • ECOMMERCE FEATURES
    • Product bundles
    • Quantity discount
    • Quantity select
    • Sale countdown timer
    • Product frequently bought
    • Product compare
    • Product wishlist
    • Product quick view
    • Multi-currency switcher
    • Product custom tabs
    • Product variation swatches
    • Variation gallery images
    • Shoppable images
    • Product video & product 360
    • Size guide
  • THEME OPTIONS
    • Theme Styling
    • Site info
    • Logo
    • Top bar
    • Header
    • Navigation
    • Page title bar & breadcrumb
    • Footer
    • Sidebars
    • Blog
    • Shop
    • Search
    • Popup
    • Instagram
    • Login/register popup
    • 404 page
    • Pre loader
    • Advanced
    • Site Identity
    • Widgets
      • How to Create a Sidebar
      • How to Add Widget in Sidebar
      • How to Edit Widget
      • How to Add Sidebar for a Page
    • Homepage settings
    • Additional CSS
    • Additional JS
    • Import/Export
  • PAGES
    • Create a page
    • Change page title
    • Page options
    • Maintenance mode
    • Onepage setup
  • MENU
    • How to create menu
    • How to create Mega menu
    • How to create Category Menu
  • WOOCOMMERCE
    • Enable Elementor for Product details
    • Cart
    • Home
    • Orders
    • Coupons
    • Settings
      • Products
      • Shipping
  • FAQs
    • Things you should know about theme updating
    • WPML plugin
    • Polylang plugin
    • Add custom font
Powered by GitBook
On this page
  1. FAQs

Add custom font

Here is how you can add custom font to MinimogWP

PreviousPolylang plugin

Last updated 1 year ago

You can add any fonts you want. However, in this guideline, we will guide you how to add font SofiaPro to the theme.

When adding custom font, you need to make some changes first. Make sure you name all the folders follow the image below.

If you use other font, just change the name of the folder containing your font to the font name.

NOTE: The font name must have connect symbol "-" The white space like "Shapiro 25 Super Fly Text" will cause problem.

Steps:

Step 1: Add font SofiaPro to child theme folder: minimog-child/assets/fonts/sofia-pro

Step 2: Add this following code to folder minimog-child/functions.php:

/**
* This is sample code to add custom font in Minimog
* This filter add your custom fonts to dropdown list using in Customize.
*
* @since Minimog 1.8.5
*/
add_filter('minimog/fonts/additional_fonts', 'minimog_child_add_custom_fonts');
function minimog_child_add_custom_fonts($additional_fonts) {
  // For eg: Custom Font name: SofiaPro.

  if( ! isset( $additional_fonts['SofiaPro'] )) {
     $additional_fonts['SofiaPro'] = 'SofiaPro, sans-serif';
  }

  return $additional_fonts;
}

/**
* This filter add your custom fonts to dropdown list using in Elementor Editor.
*/
add_filter( 'elementor/fonts/additional_fonts', 'add_custom_fonts', 10, 999 );
function add_custom_fonts( $fonts ) {
    $additional_fonts = [
        'SofiaPro' => 'minimog',
    ];
    return array_merge( $fonts, $additional_fonts );
}

/**
* This filter embed your font file to frontend.
*/
add_filter('minimog/custom_fonts/enqueue', 'minimog_child_enqueue_custom_fonts');
function minimog_child_enqueue_custom_fonts($font_family) {
  if ( strpos( $font_family, 'SofiaPro' ) !== false ) {
     /**
      * For eg: Font file locate at: minimog-child/assets/fonts/sofia-pro/font-sofia-pro.min.css
      */
     wp_enqueue_style( 'font-sofia-pro', get_stylesheet_directory_uri() . '/assets/fonts/sofia-pro/font-sofia-pro.min.css', null, null );
  }
}