Plugin counts posts views (hits) by using external AJAX based counter script of this plugin, which is best solution for caching whole page or using ot …
Plugin counts posts views (hits) by using external AJAX based counter script of this plugin, which is best solution for caching whole page or using other cache plugins.
Plugin also include widget “Popular Posts” for displaying popular posts (based on hits count) with different visibility settings and using predefined placeholders, such as {post_id}
, {post_title}
, {post_title_N}
, {post_excerpt_N}
, {post_author}
, {post_author_link}
, {permalink}
, {post_date}
, {thumbnail-[medium|...|64x64]}
, {post_categories}
, {post_hits}
and {post_comments_count}
.
You can show hits count in Posts/Pages Loop simply adding this line: <?php echo(ajax_hits_counter_get_hits(get_the_ID())); ?>
or equivalent <?= ajax_hits_counter_get_hits(get_the_ID()) ?>
Or you can use this shortcode: [hits]
.
Plugin also have JavaScript-callback function (on client) for “success” (ajaxHitsCounterSuccessCallback(xhr)
) and for “failed” (ajaxHitsCounterFailedCallback(xhr)
) result status of hits incrementation.
[hits]
, php-code <?= ajax_hits_counter_get_hits(get_the_ID()) ?>
From your WordPress dashboard:
1. Open “Plugins” > “Add New” page
2. Search for ‘AJAX Hits Counter’
3. Activate ‘AJAX Hits Counter + Popular Posts Widget’ from your Plugins page. Now widget counts hits automatically.
4. Optional. You can enable “Popular Posts Widget” in Widgets Management.
From WordPress.org:
1. Download ‘AJAX Hits Counter + Popular Posts Widget’ from plugin’s page
2. Upload archive from “Add Plugins” page or you can upload directory ajax-hits-counter
to your /wp-content/plugins/
directory
3. Activate ‘AJAX Hits Counter + Popular Posts Widget’ from your “Plugins” page. Now widget counts hits automatically.
4. Optional. You can enable “Popular Posts Widget” in Widgets Management.
ajaxHitsCounterSuccessCallback(xhr)
) or “failed” (ajaxHitsCounterFailedCallback(xhr)
) result status of increment hits scriptsr_RS
) language. Thanks to Borisa Djuraskovic.filter_var()
for PHP < 5.2.0 support.es_ES
) language. Thanks to Maria Ramos.ru_RU
) and ukrainian (uk_UA
) languages.[hits]
(or [hits id=12345]
). Thanks for the idea to AsankaD.SHORTINIT
. You can choose script type via Settings checkbox in admin area.<li>
elements: item-num-<NUMBER_IN_ORDER>
and item-id-<POST_ID>
Sorting Algorithm
.Pages & Posts
, Posts only
or Pages only
.Tools
> Import
> AJAX Hits Counter: Import from WP-PostViews
. Thanks for the idea to fabinhoalmeida.Exclude category
option. It means that Popular Posts Widget will exclude posts from selected category. In future I do it for more than one category. Thanks for the idea to fenomeno0chris.Current Category / Any
option. It means that Popular Posts Widget will display only posts from current navigated category or for any category for other pages. Thanks for the idea to benben123.day
, week
, month
, 3 months
, 6 months
, year
and all time
. Thanks for the idea to whatwillb.{post_title_N}
to Popular Posts Widget, where N
– is words count. Thanks for the idea to fenomeno0chris.{post_excerpt_N}
.ajax_hits_counter_get_hits($post_id)
for displaying hits count in your custom theme.echo(ajax_hits_counter_get_hits(get_the_ID()).' hits');
readme.txt
updates{post_excerpt_N}
to Popular Posts Widget, where N
– is words count. Thanks for the idea to meetanik.{post_author}
and {post_author_link}
to Popular Posts Widget. Thanks for the idea to ebreuers.Hits
, Comments
, Hits + Comments
) to Popular Posts Widget{post_comments_count}
to Popular Posts Widget{post_hits}
to Popular Posts Widget{post_date}
and {post_categories}
to Popular Posts Widget{post_id}
, {post_title}
, {permalink}
and {thumbnail-[thumbnail|large|medium|...|64x64]}
save_post
action