MyListing preloads the default font, and this approach is bad practice, as it assumes everyone will use it. Most website owners use a different font, so their site performance suffers until they disable it.
The Solution
MyListing Pro provides a simple toggle to apply this performance optimization.
Understanding the Issue
You’re already losing the moment you choose a font that isn’t the default. The preloaded default font takes precedence over all other web assets (files, images, etc.), preventing them from loading until they load.
You’ll see the below if you run one of the MyListing demos through a website performance tool that has the waterfall features (e.g., webpagetest.org).
domain.com
GlacialIndifference/Regular.otf
GlacialIndifference/Bold.otf
GlacialIndifference/Italic.otf
styles.css?ver=x.x.xThe preloading is done within the assets.php file in the /wp-content/themes/my-listing/includes folder; the portion of the file that loads the font is shown below.
Looking at the code, you’ll notice that the word ‘preload’ is mentioned three times for different font weights.
// theme style.css
wp_enqueue_style( 'theme-styles-default', c27()->template_uri( 'style.css' ) );
if ( apply_filters( 'mylisting/assets/load-default-font', true ) !== false ) {
wp_enqueue_style( 'mylisting-default-fonts' );
printf( '<link rel="preload" as="font" href="%s" crossorigin>', c27()->template_uri( 'assets/fonts/GlacialIndifference/Regular.otf' ) );
printf( '<link rel="preload" as="font" href="%s" crossorigin>', c27()->template_uri( 'assets/fonts/GlacialIndifference/Bold.otf' ) );
printf( '<link rel="preload" as="font" href="%s" crossorigin>', c27()->template_uri( 'assets/fonts/GlacialIndifference/Italic.otf' ) );
}