Beginner Guide: Fix the accumulated layout in WordPress

Is there any problem with the cumulative layout conversion in wordpress?

CUMULEIVE LAYOUT Shift, referred to as CLS, is an indicator centered on user experience, and is part of Google’s new Core Web Vitals program.

If you have browsed the page that will be beld in loading, then you have experienced layout conversion, and you also know how annoying the high cumulative layout conversion in WordPress is. But in addition to annoying your visitors, CLS will also affect your search engine ranking, so it is very important to solve any problems in your website.

Fortunately, you can identify and solve the problem of cumulative layout offset without becoming a technical expert. By understanding the reason and knowing how to correct them, you can reduce the number of unexpected changes on the website.

In this article, we will introduce you to Google’s Cumulative Layout Shift indicator and show you how to detect the CLS problem on your website. We will then introduce you to three simple methods to solve the problem and reduce the CLS score of your website.

Directory:

What is the cumulative layout shift?

  • How to identify the problem of cumulative layout shift
  • How to repair the cumulative layout offset
How to identify in #WordPress And #Fix accumulated #Layout changes
Click tweet

Cumulative layout conversion in wordpress

When the content on the page is on the page When moving without user interaction, layout conversion occurs.

A common example is to delay loading advertisements, and you may have encountered this on the media website. You may have started to read the text on the page, just to \”push down\” the advertisement displayed by the page after loading the text.

This is a useful visual effect provided by people from web.dev -the user intends to click \”No, return\”, but accidentally click \”Yes, order order\”, because the layout changes changes The button position moves after loading the initial page:

布局移位示例 Cumulative layout shift

is a indicator of all layouts on the page and attribute it as an indicator of scores. We will discuss the score later. But in general, high scores indicate that the layout has changed a lot (poor), and low scores indicate that the layout has changed very little (good). Zero points means that your website layout conversion problem is zero, which is perfect.

As you may imagine, the mobile element may cause your user to feel a headache. As shown in the above example, this may cause them to accidentally click on some parts of your page and even buy it unexpectedly. Even without direct consequences, many layout changes will vibrate visually. In addition, it can slow down your loading time. This seemingly small problem may have a serious impact on your audience’s user experience (UX).

Unfortunately, the problem of high Cumulative Layout Shift scores did not end. Cumulative Layout Shift is also part of Google’s new Core Web Vitals program. In Google’s Page Expersion update, the Core Web Vitals score of your website is now a small SEO ranking factor, which means that the CLS problem may affect the ranking of your website.

How to identify the problem of accumulating layout shift in WordPress [[] [[] [[] [ [[] [

[[] [

[[] [

[[] [

[[] 123] To find the Cumulation Layout Shift score and identify the problem of your website, we recommend using PageSpeed \u200b\u200bInsights. It will provide you with the overall CLS score of the site, but it will also deepen and mark the problem of specific layout conversion caused by the problem.

First, enter your URL in the box, and then click

to analyze

. This process should only take a few minutes. When you get the result, roll down to Laboratory data or field data and find cumulative layout conversion score:

]

如何在 WordPress 中查找累积布局偏移分数

From here, you can determine how your website performs in this fieldEssence As a rule of general experience, your CLS score can be divided into three potential range:

  • Good , equal to or less than 0.1
  • Good [ 123], between 0.1 and 0.25

  • difference
  • , that is, 0.25 or more

  • Since this indicator directly affects your Core Web Vitals optimization directly , So you should try to strive to be as low as possible. For more specific prompts about how to perform this operation, you can roll down to the \”
  • diagnosis

\” section and view

to avoid large layout changes . This section will list the changes in various layouts on your website:

[ 123]

This information can help point out that you may need to do some specific areas in your website. After determining the problem, you can apply some simple methods to solve it.

PageSpeed 洞察中关于如何避免 CLS 事件的说明。

How to repair the cumulative layout offset in WordPress (3 ways)

Let us see the three effective methods of solving the CLS problem. These methods are the most powerful when they are used together, so we encourage you to try every method.

1. Add dimension for your pictures, videos and advertising

If there are many media on your website, each image and video may have different sizes. No matter what kind of website you run, this can be said to be inevitable.

In essence, this difference will not directly affect your CLS score. Nevertheless, it still pose a threat -if you do not specify the size of the project, you may start to encounter a problem.

Add dimension is essential because it provides an important loading instruction for the browser. Metropolitan information can help the browser retain the correct space for the asset.

If the browser cannot do this, it may predict the error space. Therefore, the page may be corrected after loading, resulting in offset offset. The same principle is also applicable to advertising or any embedded materials on your website. Fortunately, the latest version of WordPress solves this problem to a large extent. If you insert an image through the WordPress editor, WordPress will automatically give you youDefine its size. You can view the results by selecting any media:

However, if you have used the code or add an image manually via a plug -in, you need to need Make sure the image size exists.

A bigger problem with CLS on WordPress is advertising. If you place an advertisement in the content, you need to ensure that you keep the space for these advertisements to avoid CLS.

图像清晰尺寸的示例。 One method is to apply

min-height

and

min-width

CSS attributes to

\u0026 lt \u0026 gt;

container containing your advertisement to your advertisement. -Google has a good guide to explain how to do this.

For example, if you are in ID in-content-adj ] DIV shows 300x250px ads, you can use the following code reserved space: \u0026 lt; div \u0026 gt; Set the advertising code here \u0026 lt;/div \u0026 gt;

Some advertising tools may also be Provide tools to help you achieve this goal. For example, if you are using Google ADS, Google will provide advertising editors to help you solve this problem.

2. Pre -load your font

Like the media, your website may use many different fonts. This means that they may also occupy a variable space. However, unlike the media, you cannot accurately set the size of the font.

 

The solution is to change these assets. The pre -loaded font sends a signal to the browser, indicating that it should be the first thing it generates for any given page. By containing the font first, you eliminate the need to correct the change afterwards.

If you use a large number of custom WordPress fonts, this method may be particularly important. The size of these fonts may be very different from ordinary fonts, which means that this simple change may have a great impact. However, even websites that rely less on fonts may experience at least slight CLS scores.

Many WordPress performance plugins include options for pre -load fonts. For example, autoptimize, ASset Cleanup, Perfmatters, and WP Rocket. For most people, one of these plugins is the simplest solution to pre -load WordPress fonts. However, for more advanced users, you can also use your custom code fragment pre -loading font. To add this code fragment, you need to edit the sub -theme header.php

file. You can edit this file by transferring to the

appearance \u0026 gt; theme editor

on the WordPress website to edit this file:

]

主题标题部分的视图,可以对其进行自定义以降低累积布局偏移的几率。 After editing

Header.php

in your sub -theme, roll to the bottom of the page, then then Copy and paste the following code lines to ensure that the sample font link (

roboto.woff2 in this example) is replaced with the actual link of the font file you used on the website: \u0026lt;link rel\u003d\u0026quot;preload\u0026quot; href\u003d\u0026quot;roboto.woff2\u0026quot; as\u003d\u0026quot;font\u0026quot; type\u003d\u0026quot;font/woff2\u0026quot; crossorigin\u003d\u0026quot;anonymous\u0026quot;/\u0026gt;

 准备After, click  to update the file 

to save the change. This is what you have to do -the font of your website is now prioritized in the browser.

3. Optimize your dynamic content

Finally, let us talk about the dynamic content of your website. Dynamic content (such as news and communication registration forms, application installation prompts, GDPR notifications, etc.) can all can re -adjust the browser after the page has been loaded mostly loaded.

However, this is only applicable to Not dynamic content triggered by users Essence For example, if you are loading the automatic notification bar to say hello to people on your homepage, this may damage your CLS score.

There are two ways to solve this problem:

Only touched the dynamic content after user interaction, noIt will affect your CLS score. For example, you may not display an email to select the form immediately, but trigger it when the user clicks the button to create two steps to choose to join.

Use CSS as a dynamic element to retain space, similar to the content we discussed above. For example, if you use CSS to retain the space on the top of the page, you can still load the column without leaving the layout offset.

  1. Turn to the top

  2. Permanently repair the cumulative layout in WordPress

If you want to create a good user experience and improve you In the Core Web Vitals, it is important to have a lower Cumulative Layout Shift score. Fortunately, it is not difficult to prevent this annoying problem. Just pay attention to some simple settings, you can correct the loading problem of the website.

How to identify in #WordPress in #WordPress Cumulative #Layout shift problem (and fix them)

Click tweet

In this article, we introduced three types of three types Repair and reduce the method of accumulating layout offset in WordPress:

Make sure all your media and advertisements have clearly defined size. WordPress will automatically process the images you embedded in the editor, but you may need to manually define the size of the advertisement and any image you add outside the editor.

Pre -load fonts to avoid the last moment of adjustment.

Note how you realize dynamic content -by requiring users to interact or retain space for any dynamic element.

  1. Do you have any questions about improving the cumulative layout conversion in WordPress?

  2. Let’s know in the comments!

Free Guide Five basic techniques to speed up speed Your WordPress website will shorten the loading time by 50-80 %

Just follow simple prompts.

free guide

Author:

Leave a Reply

Your email address will not be published. Required fields are marked *