Original link: https://www.williamlong.info/archives/6920.html
Generally, adding reading statistics for WordPress articles will use various statistical plug-ins, which consume system resources, and many plug-ins conflict with static or CACHE WordPress. Here is a way to share two paragraphs here to achieve WordPress article reading without plug-ins. The code for the number of times supports fully static WordPress for your reference.
Edit the template file of the article page and add the following HTML code where you need to display the number of readings:
After that, add the following HTML code at the bottom of the article page template,
var js = document.createElement(“script”);
js.src = “/wp-counter.php?post_id=” + escape(strBatchView);
In this way, the WordPress plugin-free article reading function can be realized, and the fully static WordPress system can be supported.
This article is reprinted from: https://www.williamlong.info/archives/6920.html
This site is for inclusion only, and the copyright belongs to the original author.