WP-PostViews call methods
A, WP-PostViews Introduction
The plug-in is the function of an article to be read statistics and frequency can be achieved Sidebar Widget and display most popular (read the most number) article, the most popular (read the most number) under the classification of certain articles and other functions, support for the latest WP 2.92 version.
Two, WP-PostViews Installation
The extract obtained after postviews upload folder to / wp-content / plugins folder
WP-PostViews plug activation, may then be provided to the Options
Three, WP-PostViews use
(A) general application
Modify / wp-content / themes / YOUR THEME NAME / index.php (single.php, post.php or the page.php)
If you modify index.php found
PHP code
? Php while (have_posts ()): the_post ();?
Add the following statement to how local needs
PHP code
? Php if (function_exists ( 'the_views')) {the_views ();}?
Login "WP-Admin - Options - Post Views" you can configure the plugin
Count Views From the statistics set of users
Views Template The plug-in display style
(B) use Sidebar Widget
Activate "WP-PostViews Widget" plugin
Login " 'wp-admin - Presentation - Widgets"
In order to display the "Most Viewed Post (popular article)" dragging (Drag) "Most Viewed Widget" to the sidebar
You can click the icon to configure the "Most Viewed Widget" to configure, and then click the "Save changes" to save
(C) the use of call
1, showing the most popular (read most often) article, use the following statement
PHP code
? Php if (function_exists ( 'get_most_viewed')):?
? Php get_most_viewed ();?
? Php endif;?
The first value is the type you want in the list is "article" or "page" or "both", such as " 'pos", "page" or "both"
The second value is the number of objects you want to get a list of
The default is this:
PHP code
get_most_viewed ( 'both', 10); // get the 10 most viewed posts and pages
2, display a category of the most popular (read most often) Articles
PHP code
? Php if (function_exists ( 'get_most_viewed_category')):?
? Php get_most_viewed_category ();?
? Php endif;?
The first value is the ID of Categories
The second value is the type of a list of "article" or "page" or "both", such as "post", "page", "both '"
The third value is the number of objects in the list
The default is this:
PHP code
get_most_viewed_category (1, 'both', 10); // ID directory for the next 1 to read up to 10 articles and pages
Four, WP-PostViews upgrade
Disabling plugin WP-PostViews
Upload and cover postviews file / wp-content / plugins folders
Delete files postviews.php
WP-PostViews activation plug-ins
Copyright Protection: ShuDudu from the original article, reproduced Please keep the link: https://www.shududu.com/netweb/WP-PostViews-call-methods.htm