php - Using custom fonts hosted on AWS S3 in a Wordpress site -
i have fonts typography.com moved production , uploaded aws s3 bucket use on wordpress site. have done typography.com has told me do, fonts still not being displayed. has gone through before , can point me in right direction? added @import statement in style.css in theme url typography.com gave me. have wp_enqueue function in functions.php have uploaded s3 server.
add_action( 'wp_head', 'my_fonts' ); function my_fonts(){ ?> <link rel="stylesheet" type="text/css" href="//cloud.typography.com/7783912/761788/css/fonts.css"> <?php }
the fonts still not being displayed. doing wrong?
the proper way include stylesheets use wp_enqueue_style
. using function allow declare font dependency other stylesheets. should use 'wp_enqueue_scripts'
hook, opposed 'wp_head'
:
/** * proper way enqueue scripts , 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 @ point, make sure have proper permissions file typography cloud server.
Comments
Post a Comment