Site logo

Archived topic

I couldn't achieve to add my font to local

3 replies · Started by Gurer on December 20, 2021

Viewing posts 1–4 of 4

Hi,
I followed and done all the steps in your tutorial but couldn't achieve to add my font to local.
The font name is Gotham.
1- All files are added in media gallery.
2- I added @font-face below block-editor.css and style.css to child theme.
@font-face {
font-family: 'Gotham';
src: url('https://www.wpdemopark.com/wp-content/uploads/2021/12/Gotham-Bold.ttf') format('truetype');
font-weight: bold;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'Gotham';
src: url('https://www.wpdemopark.com/wp-content/uploads/2021/12/Gotham-Bold_1.ttf') format('truetype');
font-weight: bold;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'Gotham';
src: url('https://www.wpdemopark.com/wp-content/uploads/2021/12/Gotham-Book.ttf') format('truetype');
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'Gotham';
src: url('https://www.wpdemopark.com/wp-content/uploads/2021/12/Gotham-LightItalic.ttf') format('truetype');
font-weight: 300;
font-style: italic;
font-display: swap;
}

@font-face {
font-family: 'Gotham';
src: url('https://www.wpdemopark.com/wp-content/uploads/2021/12/Gotham-BoldItalic.ttf') format('truetype');
font-weight: bold;
font-style: italic;
font-display: swap;
}

@font-face {
font-family: 'Gotham';
src: url('https://www.wpdemopark.com/wp-content/uploads/2021/12/Gotham-Book_1.ttf') format('truetype');
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'Gotham';
src: url('https://www.wpdemopark.com/wp-content/uploads/2021/12/Gotham-Bold_2.ttf') format('truetype');
font-weight: bold;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'Gotham';
src: url('https://www.wpdemopark.com/wp-content/uploads/2021/12/Gotham-Book_2.ttf') format('truetype');
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'Gotham';
src: url('https://www.wpdemopark.com/wp-content/uploads/2021/12/Gotham-Book_3.ttf') format('truetype');
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'Gotham';
src: url('https://www.wpdemopark.com/wp-content/uploads/2021/12/Gotham-Medium.ttf') format('truetype');
font-weight: 500;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'Gotham';
src: url('https://www.wpdemopark.com/wp-content/uploads/2021/12/otham-Light.ttf') format('truetype');
font-weight: 300;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'Gotham';
src: url('https://www.wpdemopark.com/wp-content/uploads/2021/12/Gotham-BookItalic.ttf') format('truetype');
font-weight: normal;
font-style: italic;
font-display: swap;
}

3- I added the action
add_action( 'enqueue_block_editor_assets', function() {
wp_enqueue_style( 'your-handle-here', get_stylesheet_directory_uri() . "/block-editor.css", false, '1.0', 'all' );
} );

Can you please help?
Best regards,
Gurer

Hi Gurer,

The font URLs are leading to 404 page.

Can you check if the URLs are correct?

Great, problem solved, I appreciate Ying!

You are welcome :)

This archived topic is closed to new replies.