Home › Forums › Weaver Show Posts & Show Sliders › Disable caching for Show Post
- This topic has 11 replies, 3 voices, and was last updated 2 years, 3 months ago by
Weaver.
-
AuthorPosts
-
February 8, 2021 at 17:42 UTC - Views: 38 #67300
Greendroid
ParticipantHi,
I am also using the Weaver Show Post plugin to disable some “Recommended further articles” below each of my posts.
Unfortunately I am using W3 Total Cache to seepdup my side. This plugin is caching the side, so the further articles are always the same.
I would like to have, that the user can reload the page and then a different set of articles are shown.For example on this webpage:
I am already in contact with the W3 Total Cache support to get a workaround for it. Unfortunately they could not help until know and were asking if you could perhaps support as well.
Please take a look into this forum to see the requests from the W3 Total Cache support. I only understand it partially…
https://wordpress.org/support/topic/do-not-cache-suggested-posts/Thanks and kind regards
GreendroidFebruary 8, 2021 at 18:15 UTC - Views: 35 #67303February 15, 2021 at 16:02 UTC - Views: 31 #67351Greendroid
ParticipantFebruary 15, 2021 at 17:28 UTC - Views: 28 #67354scrambler
Moderator@weaver, from reading the thread, they say the best way to exclude the Show post execution from the cache would be if
“The widget would be fired with an ajax call”
Is that something that would make sense for you to entertain?
@Greendroid. the issue I see with that, is that for most people I am sure they would want the Shortcode to be cached, so this sounds like a One of need not a wide requirement ….
February 15, 2021 at 20:15 UTC - Views: 27 #67356Greendroid
ParticipantHi,
yes, it could be, that this is a very strange and rare reqirement.
I also want to get hte shortcode cached on my blogpage for example. But I am also using the plugin now to show some featured/recommended articles below the page. So I thought it would be helpful, that they are not cached, so the user can reload the page and can get some new recommendations 😀Thanks and kind regards
GreendroidFebruary 16, 2021 at 21:14 UTC - Views: 22 #67362Weaver
KeymasterUsing any AJAX seems like overkill for a show post plugin. And frankly, I’m don’t even have an understanding of how or when to use AJAX for the shortcode.
Perhaps there is an independent “show sortcode” plugin that has the ability to disable caching for the code fragment.
But it definitely is not something that I have the time or resources to add. Show Posts is a stable plugin, and the only changes I would ever make to it would be for WP version compatibility.
February 17, 2021 at 19:16 UTC - Views: 19 #67366Greendroid
ParticipantHi weaver,
thanks for commenting on this.
You are completely right, the plugin is very stable and is working perfectly fine. I just wanted to evaluate if this would be possible in general 🙂I see, that the plugin code is directly added static to the html code, so I think, that there is also no possibility to add a “Reload”-button for the random-recommended-posts, right?
Thanks and kind regards
GreendroidFebruary 17, 2021 at 23:21 UTC - Views: 17 #67373Weaver
KeymasterYou couldn’t just reload the posts, but you could reload the page with a simple HTML link placed above or below the shortcode:
<a href=”#”>Reload</a>
Add a paragraph, div with spacing, or whatever you want to place the Reload link. Could make it a button if you want (borders, background color, rounding in a div with style rules)
February 18, 2021 at 15:49 UTC - Views: 15 #67377Greendroid
ParticipantHi,
yes, for sure. A complete Page Reload is possible, but this would not cause a Reload of the WeaverShowPosts, because they are cached 😀
So I think my approach is not working like this.
Anyhow, thanks for the support and kind regards
GreendroidFebruary 18, 2021 at 18:49 UTC - Views: 10 #67382Weaver
Keymasterif the show posts are displayed by using the shortcode on a page, then reloading the page should also reload those posts as the html for those would be generated on the server whenever the page is refreshed. I don’t see how that content would be cached separate from the rest of the page. I’m not positive that a whole page refresh bypasses caching, however, There might be a way to have a refresh button that would force cache refreshing beyond the simple reload code I provided. I just don’t know how caching works for sure.
February 19, 2021 at 16:01 UTC - Views: 7 #67390Greendroid
ParticipantThanks for the support.
I think I will dismiss this idea 🙂
Kind Regards
GreendroidFebruary 20, 2021 at 21:37 UTC - Views: 9 #67392Weaver
KeymasterJust a final note: As far as I understand most caching plugins, the content of most pages (pages, posts, blog displays, output of show_posts) will always be considered as static content. Only content that is dynamically generated for a give page would not be cached. The only kind of dynamic content is in some way or another controlled by JavaScript, which is executed as a page is loaded – either newly or as a page refresh. The most common form of dynamic content I think any of us are aware of on a daily basis is advertising. Some ads are static – as when your site might provide its own ads, but most are done through some kind of advertising code that will pull the ads in from some ad server. There could also be others – maybe a ticking clock which could change the time by Javascript calls. The AJAX stuff mentioned way back is all initiated from Javascript.
I could imagine someone writing a totally dynamic plugin to pull in posts dynamically, but that is way beyond the design goals of Show Posts. It was never designed to behave that way, and would essentially have be re-written from scratch to work that way – obviously something we will not do.
And another thing to note – caching can happen several places along the line of serving a page. Browsers can have client side caching which will load some content only once – like css files, images, and other items. There are intermediate caches – like Cloudflare – that can cache those same things on the Cloudflare servers, and thus serve that sort of content without generating addtional requests to the server. These two can work together. And finally, there are server side caches that make sense for contant that is dynamically generated on the server – such as a WordPress page or post. With this kind of caching, the cache program will take all of the dynamically generated content generated by WordPress, and store essentially static HTML files on the server (including the css, image, and javascript files). Then when a page is served, the overhead of having WordPress PHP code dynamically generated the content (which involves potentially “expensive” calls to the database), the pages are simply served from the HTML cache. Various triggers are used to force a WP caching plugin to regenerate the cached pages – like editing the page or post content. From the point of view of the client (or intermediate content caching), there is no difference between a fully dynamically generated page from the server, or a cached page generated by the server.
So, without JavaScript that runs on the client and not the server, it is impossible to generate dynamic server side cached content
So therein lies the issue with [show_posts]. Shortcodes are simply a tool that allow WP to generate page content. That content is static – whether served directly or via cache plugin. So, without JavaScript that runs on the client and not the server, it is impossible to generate dynamic server side cached content. And getting dynamic generated content from JavaScript is not free. One more or less doubles the overhead of communication between the host server and the client on the visitors computer. So in the end, serving content that way will likely end up slower than just generating the content dynamically (i.e., not cached) on the server. And this becomes very obvious if you pay attention the how slow web pages with lots of advertising included really are. The static content is delivered fairly quickly, then the page will slowly load the ads, along with annoying reformatting of the total page layout as the individual ads cause the page to be reformatted.
-
AuthorPosts
- You must be logged in to reply to this topic.