Slowly but steadily in the last few weeks the CLS for the mobile theme of the website began to increase again. In the following topic: https://forum.tagdiv.com/topic/improve-cumulative-layout-shift-cls/ you have mentioned that the CLS is caused by various AJAX Options like the AJAX View Count.
Considering that please can you tell me where I can disable the AJAX View Count in the mobile theme and if there other AJAX options that should be disabled?
Greetings Kathrin
Hi Topfgartenwelt, the AJAX View Count from mobile theme plugin will be disable when you disable it from theme panel -> https://i.imgur.com/bjnlUCp.png -> https://i.imgur.com/fDeLnVR.png
Also the mobile theme plugin is using the settings from standard pack templates (standard post templates settings from theme panel, therefore if you disable the options that you do not want from theme panel, it will apply on mobile theme plugin too).
Thank you!
I have disabled the AJAX View Count in the themepanel but it didn’t disappear on the posts in the mobile theme. It’s still there. I haven’t installed the standard pack. Is there another way (for example in the code) to disable the AJAX View Count in the mobile theme? The view count doesn’t appear in the desktop theme.
Greetings Kathrin
-
This reply was modified 5 years by
Topfgartenwelt.
Hi Topfgartenwelt, the mobile theme options can be enable disable only from standard pack, what you can do is to activate this plugin, disable the option from theme panel for view count then disable the plugin (the option will be saved in database, therefore will not be affected if the plugin is enable or disable).
Thank you!
So I have to install the plugin, disable the view count and than delete the plugin?? That seems a little bit weired.
In the following path: /wordpress/wp-content/plugins/td-composer/mobile I found the following code:
// posts view count with ajax
if( td_util::get_option(‘tds_ajax_post_view_count’) == ‘enabled’ ) {
// ajax get & update counter views
if( is_single() ) {
if( $post->ID > 0 ) {
td_js_buffer::add_to_footer(
‘jQuery().ready(function jQuery_ready() {
tdAjaxCount.tdGetViewsCountsAjax(“post”,’ . json_encode(‘[‘ . $post->ID . ‘]’) . ‘);
});’
);
}
}
}
Isn’t it possible to comment that part of code out? I don’t wont to install the standard pack because it slows down the theme extremely.
Greetings Kathrin
-
This reply was modified 5 years by
Topfgartenwelt.
Hi Topfgartenwelt,
Yes, you can comment that code but the problem will be that you’ll need to do that after each theme update.
If you use the standard pack to disable that option, then the settings for mobile theme will be saved in database, and will not be affected if the standard pack will di removed or you’ll make a theme update.
You can try the option you want, I personally recommend the second one, in that there will be no need for changes after theme update.
Thank you!
Ok, I will try it out and will report to you.
Greetings Kathrin
Commenting out didn’t work and let the site go down, but deactivating in the standard pack worked. After that I have deinstalled it again and hope that the CLS goes down again 🙂
Greetings Kathrin
The CLS for the mobile theme seems to be stable after deactivating the Ajax View Count. But now I have another problem, it completely stopped to count the views of a post in the backend. I just wanted to deactivate the View Count in the Frontend. Isn’t there a way to do that?
Greetings Kathrin
Hi Topfgartenwelt,
That is the same function, therefore if you remove one, the view count will stop for entire website. The code that is use for the view count on frontend is only to display it, not (is taking the data from database and in database is updated using the function that you comment).
Thank you for your understanding!
I have followed all your instructions but since the last update the CLS on the mobile version is increasing again. What could be the problem this time?
Greetings Kathrin
Hmm, after updating the theme I’m adding all the changes again.
What do you mean with caches?
Greetings Kathrin