WP-PostViews

Description

Utilisation

  1. Open wp-content/themes/<YOUR THEME NAME>/index.php
  2. You may place it in archive.php, single.php, post.php or page.php also.
  3. Find: <?php while (have_posts()) : the_post(); ?>
  4. Add Anywhere Below It (The Place You Want The Views To Show): <?php if(function_exists('the_views')) { the_views(); } ?>
  5. Or you can use the shortcode [views] or [views id="1"] (where 1 is the post ID) in a post
  6. Go to WP-Admin -> Settings -> PostViews to configure the plugin.

Build Status

Développement

https://github.com/lesterchan/wp-postviews/

Traductions

http://dev.wp-plugins.org/browser/wp-postviews/i18n/

Crédits

Dons

J’ai passé beaucoup de mon temps libre à la création, mise à jour, et support de cette extension. Si vous aimez et pouviez me donner quelques dollars, cela serait appréciable. Si ce n’est pas le cas, n’hésitez pas à l’utiliser sans aucune obligation.

Captures d’écran

  • PostViews
  • Admin - PostViews Options

FAQ

How To View Stats With Widgets?
  • Go to WP-Admin -> Appearance -> Widgets
  • The widget name is Views.
To Display Least Viewed Posts

<?php if (function_exists('get_least_viewed')): ?>
<ul>
<?php get_least_viewed(); ?>
</ul>
<?php endif; ?>

  • The first value you pass in is the post type that you want. If you want to get every post types, just use ‘both’. It also supports PHP array: example array('post', 'page').
  • The second value you pass in is the maximum number of post you want to get.
  • Default: get_least_viewed(‘both’, 10);
To Display Most Viewed Posts

<?php if (function_exists('get_most_viewed')): ?>
<ul>
<?php get_most_viewed(); ?>
</ul>
<?php endif; ?>

  • The first value you pass in is the post type that you want. If you want to get every post types, just use ‘both’. It also supports PHP array: example array('post', 'page').
  • The second value you pass in is the maximum number of post you want to get.
  • Default: get_most_viewed(‘both’, 10);
To Display Least Viewed Posts By Tag

<?php if (function_exists('get_least_viewed_tag')): ?>
<ul>
<?php get_least_viewed_tag(); ?>
</ul>
<?php endif; ?>

  • The first value you pass in is the tag id.
  • The second value you pass in is the post type that you want. If you want to get every post types, just use ‘both’. It also supports PHP array: example array('post', 'page').
  • The third value you pass in is the maximum number of post you want to get.
  • Default: get_least_viewed_tag(1, ‘both’, 10);
To Display Most Viewed Posts By Tag

<?php if (function_exists('get_most_viewed_tag')): ?>
<ul>
<?php get_most_viewed_tag(); ?>
</ul>
<?php endif; ?>

  • The first value you pass in is the tag id.
  • The second value you pass in is the post type that you want. If you want to get every post types, just use ‘both’. It also supports PHP array: example array('post', 'page').
  • The third value you pass in is the maximum number of post you want to get.
  • Default: get_most_viewed_tag(1, ‘both’, 10);
To Display Least Viewed Posts For A Category

<?php if (function_exists('get_least_viewed_category')): ?>
<ul>
<?php get_least_viewed_category(); ?>
</ul>
<?php endif; ?>

  • The first value you pass in is the category id.
  • The second value you pass in is the post type that you want. If you want to get every post types, just use ‘both’. It also supports PHP array: example array('post', 'page').
  • The third value you pass in is the maximum number of post you want to get.
  • Default: get_least_viewed_category(1, ‘both’, 10);
To Display Most Viewed Posts For A Category

<?php if (function_exists('get_most_viewed_category')): ?>
<ul>
<?php get_most_viewed_category(); ?>
</ul>
<?php endif; ?>

  • The first value you pass in is the category id.
  • The second value you pass in is the post type that you want. If you want to get every post types, just use ‘both’. It also supports PHP array: example array('post', 'page').
  • The third value you pass in is the maximum number of post you want to get.
  • Default: get_most_viewed_category(1, ‘both’, 10);
To Sort Most/Least Viewed Posts
  • You can use: <?php query_posts( array( 'meta_key' => 'views', 'orderby' => 'meta_value_num', 'order' => 'DESC' ) ); ?>
  • Or pass in the variables to the URL: http://yoursite.com/?v_sortby=views&v_orderby=desc
  • You can replace DESC with ASC if you want the least viewed posts.
To Display Updating View Count With LiteSpeed Cache

Use: <div id="postviews_lscwp"></div> to replace <?php if(function_exists('the_views')) { the_views(); } ?>.
NOTE: The id can be changed, but the div id and the ajax function must match.
Replace the ajax query in wp-content/plugins/wp-postviews/postviews-cache.js with

`

jQuery.ajax({
type: »GET »,
url:viewsCacheL10n.admin_ajax_url,
data: »postviews_id= »+viewsCacheL10n.post_id+ »&action=postviews »,
cache:!1,
success:function(data) {
if(data) {
jQuery(‘#postviews_lscwp’).html(data+’ views’);
}
}
});
`

Purge the cache to use the updated pages.

Avis

COUNTER IS UNRELIABLE!

I don’t like leaving bad reviews but I have to in hopes of plugins improving.

Counter is very unreliable. Views are not unique with no option to select unique, and for some reason only with this plugin, the views kept counting twice for each page refresh.

Found another plugin for counting page views that connected to Google Analytics for counting.

Une extension simple mais efficace

Simple d’utilisation, faisant ce qu’on lui demande (compter les vues d’un article ou d’une page) sans problème et installée sur des sites en production depuis 2006, cette extension a passé sans encombre toutes les mises à jour majeures de WordPress et fonctionne aujourd’hui encore, à l’heure où j’écris, avec la V4.8.2.

Like the Shortcodes

You can put them on any text-field which then can be counted.
Therefore it does what it should, but not what it could.

E.g. the settings are better in https://de.wordpress.org/plugins/post-views-counter/ (which I also just gave 4 stars) and they provide shortcodes, too!
Therefore I’m morelikely to use the other one.

Both plugins should provide daily, weekly data etc. to make them a 5-star plugin.

Suggestion

Add the date of the views, to allow them to be listed by period.

Example: most watched posts in 30 days

Lire les 49 avis

Contributeurs & développeurs

« WP-PostViews » est un logiciel libre. Les personnes suivantes ont contribué à cette extension.

Contributeurs

“WP-PostViews” a été traduit dans 5 locales. Remerciez l’équipe de traduction pour ses contributions.

Traduisez « WP-PostViews » dans votre langue.

Le développement vous intéresse ?

Parcourir le code, consulter le SVN dépôt, ou s’inscrire au journal de développement par RSS.

Journal

Version 1.75

  • NEW: Use WP_Query() for most/least viewed posts

Version 1.74

  • NEW: Bump WordPress 4.7
  • NEW: Template variable %POST_CATEGORY_ID%. It returns Post’s Category ID. If you are using Yoast SEO Plugin, it will return the priority Category ID. Props @FunFrog-BY

Version 1.73

  • FIXED: In preview mode, don’t count views

Version 1.72

  • NEW: Add %POST_THUMBNAIL% to template variables

Version 1.71

  • FIXED: Notices in Widget Constructor for WordPress 4.3

Version 1.70

  • FIXED: Integration with WP-Stats

Version 1.69

  • NEW: Shortcode [views] or [views id= »POST_ID »]` to embed view count into post
  • NEW: Added template variable %VIEW_COUNT_ROUNDED% to support rounded view count like 10.1k or 11.2M

Version 1.68

  • NEW: Added action hook ‘postviews_increment_views’ and ‘postviews_increment_views_ajax’
  • NEW: Allow custom post type to be chosen under the widget

Version 1.67

  • NEW: Allow user to not use AJAX to update the views even though WP_CACHE is true

Version 1.66

  • NEW: Supports MultiSite Network Activation
  • NEW: Add %POST_DATE% and %POST_TIME% to template variables
  • NEW: Add China isearch engines bots
  • NEW: Ability to pass in an array of post types for get_most/least_*() functions. Props Leo Plaw.
  • FIXED: Moved uninstall to uninstall.php and hence fix missing nonce. Props Julio Potier.
  • FIXED: Notices and better way to get views from meta. Props daankortenbach.
  • FIXED: No longer needing add_post_meta() if update_post_meta() fails.

Version 1.65 (02-06-2013)

  • FIXED: Views not showing in WP-Admin if « Display Options » is not set to « Display to everyone »