I am developing a WordPress website using a minimalist JavaScript framework + Timber. I have noticed that between pages, there is about 1500ms delay. I wanted to use W3 Total Cache, or WP Super Cache to see if I can use the cache features so it can load the pages faster.
It does seem to be faster, however I have some rendering problems. Because i'm using Timber, I have partial templates, one example looks like this.
Contacts.twig
{% extends "_base.twig" %}
{% block content %}
{% if not isAJAX %}<section>{% endif %}
<div>
<div>
<section>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Necessitatibus quis doloribus libero et harum, molestiae, nam alias voluptatem sequi rem inventore aliquid reiciendis</p>
</section>
</div>
</div>
{% if not isAJAX %}</section>{% endif %}
{% endblock %}
When I activate W3 Total Cache, when I reload this page, http://example.com/contact, it only renders out this particular HTML strings, there is no header or footer, meaning it does not render out the _base.twig
.
In my contact.php
, it looks like
<?php
/**
* Template Name: Contact Template
*/
$context = Timber::get_context();
Timber::render('views/contact/contact.twig', $context);
Are there any Timber/WordPress experts who know how I can use W3 Total Cache correctly?