Home > CMS Tutorial > WordPress > What do you need to use to query page views in WordPress?

What do you need to use to query page views in WordPress?

Release: 2019-07-25 11:39:29
Original
3425 people have browsed it

What do you need to use to query page views in WordPress?

WordPress query page views can use the wp-postviews plug-in to display the number of page views.
Let’s take a look at how to install the wp-postviews plug-in for WordPress 4.7.

1. First, search for the wp-postviews plug-in in the plug-in bar and install it. Installation failure may be a directory permissions issue. Just enter the WordPress directory and change the permissions of the wp-content folder to 777:

chmod -R 777 wp-content</code>
Copy after login

2. After successful installation, in the plug-in column, activate the wp-postviews plug-in. This is the most important step, which is to display the number of views. At the end of the article, you need to modify the theme code. First open the folder where the theme is located:

cd /var/www/html/wordpress/wp-content/themes/twentyfifteen
Copy after login

3. At this time, you can see the relevant files in the directory of the currently used theme. Open content.php and add the code

<?php if(function_exists(‘the_views’)){ the_views();} ?>
Copy after login

What do you need to use to query page views in WordPress?

at the location shown in the picture. Here you can see the number of views displayed at the end of the article.

For more wordpress related technical articles, please visit the wordpress tutorial column to learn!

The above is the detailed content of What do you need to use to query page views in WordPress?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template