Answer the question
In order to leave comments, you need to log in
How to cache a single wordpress template?
Good afternoon.
There is a site on wp, 500+ pages.
The main page for mobile devices should be different from the desktop version.
At what to differ cardinally.
Therefore, I decided to get out of this situation in this way:
In the main page template - page-home.php I wrote a simple condition:
<?php /* Template Name: Home */ ?>
<?php
if(wp_is_mobile()):
include_once("page-home-mobile.php");
else:
include_once("page-home-desctop.php");
endif;
?>
Answer the question
In order to leave comments, you need to log in
You will need to look at the caching plugin code and find the place where you can turn it on and help it understand that if we have wp_is_mobile() true, then we take (or create and take) the mobile cache, if false - the desktop one. If their caching method through mod_rewrite is used, then the settings of these rewrites will also need to be tweaked, at the server level you define desktop / mobile.
The description of the plugin says:
That is, the plugin already knows how to distinguish between devices, by definition. It might be worth looking to see if he has hooks there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question