Print

Print


I use and recommend W3 Total Cache. With that said, while it is extremely versatile it is also all-encompassing. Its simple page cache--like any good .htaccess caching--is powerful, and for it to take for example new styles you would need to add cache-busting params in your header (like link to styles.css?ver=1.9.2). If you have enough control over your environment you can sometimes automate that. 

But not caching specific elements in the page? I'm not sure. 

You might consider generating the hours with javascript, this will ensure that the display is dynamic and refreshed on page-load. Consider Matt Riedsma's "Today's Hours" script (https://github.com/mreidsma/Today-s-Hours).

We actually set the hours as a custom post type and then use the Wordpress JSON API to pull that information in with javascript. That way there's also a front end for setting the hours - esp. if you have other staff or other departments who wouldn't be comfortable setting the hours in a script. 

Michael / ns4lib.com

-----Original Message-----
From: Code for Libraries [mailto:[log in to unmask]] On Behalf Of Ed Summers
Sent: Wednesday, May 29, 2013 3:35 AM
To: [log in to unmask]
Subject: Re: [CODE4LIB] Wordpress: Any way to selectively control caching for content areas on a page?

If your Wordpress happens to be fronted by Varnish you might get some mileage out of using Edge Side Includes (ESI)

    https://www.varnish-software.com/static/book/Content_Composition.html#edge-side-includes

If you google for Edge Side Includes and Wordpress you'll find some articles like this describing how ESI's were used with Wordpress:

   http://timbroder.com/2012/12/getting-started-with-varnish-edge-side-includes-and-wordpress.html

So, it might be do-able.

//Ed

On Tue, May 28, 2013 at 5:30 PM, Wilhelmina Randtke <[log in to unmask]> wrote:
> In a Wordpress site, is there a way to allow site-wide caching, but 
> force certain areas of a page to reload on each visit?
>
> For example, if  on a specific page there is a huge navigational menu 
> that never changes, a map that rarely changes, and hours of operation 
> which change frequently (as often as holidays), is there a way to 
> force only the hours of operation to reload when a person revisits the page?
>
> -Wilhelmina Randtke