Site logo

Archived topic

Dispatch theme has Largest Contentful Paint

3 replies · Started by Wayne on April 14, 2021

Viewing posts 1–4 of 4

How do i improve the Largest Contentful Paint for my site? I noticed on many speed test sites espeially google page speed insights that the largest contentful paint is pretty slow on mobile. Is there a way to fix this?

I'm optimizing the images and using a cdn and wprocket as much as I can but it is still pretty slow. How can I make this faster?

I provided the links in the private information down below. You'll notice that all of my posts have a slow load time.

so the code is

add_action( 'wp_head', function(){
  $featured_img_url = get_the_post_thumbnail_url(get_the_ID(),'medium_large');
  if ($featured_img_url) {
    echo '
    <style>
    @media(max-width: 768px) {
      .page-hero {
        background-image: url(' . $featured_img_url . ');
      }
    }
    </style>';		
  }
});

is that the code?
And how do i put it in my site?

This archived topic is closed to new replies.