Using custom fonts hosted on AWS S3 in a Wordpress site
The proper way to include stylesheets is to use wp_enqueue_style
. Using this function will also allow you to declare this font as a dependency for other stylesheets. You should also use the 'wp_enqueue_scripts'
hook, as opposed to 'wp_head'
:
/** * Proper way to enqueue scripts and styles */function theme_name_scripts() { wp_enqueue_style( 'typography', '//cloud.typography.com/7783912/761788/css/fonts.css' );}add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
If you're still having issues at this point, make sure you have the proper permissions to GET this file from the Typography cloud server.