开发者 | devdesigndazzle |
---|---|
更新时间 | 2025年5月18日 06:27 |
PHP版本: | 7.4 及以上 |
WordPress版本: | 6.7 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
[dddPostViews]
to show views for a single post, with options to limit it by timeframe, such as daily or monthly. Want to display views for a specific post outside its page? Just add a post_id
like [dddPostViews post_id="123" timeframe="monthly"]
. Developers can use the PHP function <?php echo dddPostViews_display_post_views(['post_id' => 123, 'timeframe' => 'monthly']); ?>
for the same result. And if you want to showcase your most popular content, the [dddPostViews_top_posts]
shortcode creates a responsive grid or list of top posts, sorted by views, with options to tweak the number of posts, timeframe, and excerpt length.
Key Features of Post Views by DevDesignDazzle
[dddPostViews]
and [dddPostViews_top_posts]
with tons of options./wp-content/plugins/
.It tracks views with a 6-hour window to prevent duplicates, using sessions and secure, HTTP-only cookies. Admin views and bot traffic get filtered out automatically for trustworthy numbers.
You’ve got three great options to show post views anywhere on your site:
[dddPostViews]
to display views for the current post. Add a timeframe like daily
, monthly
, or total
to filter the count. Need views for a specific post? Try [dddPostViews post_id="123" timeframe="monthly"]
to show last month’s views for post ID 123.<?php echo dddPostViews_display_post_views(); ?>
into theme files. It works just like the shortcode, so <?php echo dddPostViews_display_post_views(['post_id' => 123, 'timeframe' => 'monthly']); ?>
gives you the same result as above.[dddPostViews_top_posts]
. It creates a responsive grid or list of top posts, sorted by views in descending order, based on your chosen timeframe. Options include display
(set to minimal
for a list in widgets or full
for a grid), number
(how many posts to show), timeframe
(daily, monthly, or total), and excerpt_length
(word count for each post’s excerpt). For example, [dddPostViews_top_posts display="full" number="5" timeframe="monthly" excerpt_length="15"]
shows five top posts from the past month in a grid with 15-word excerpts.$post_ids = dddPostViews_get_top_posts(5, 'total');
and build custom displays however they like.Not at all! It uses WordPress caching with a 1-hour duration and optimized database queries to stay lightning fast.
The plugin’s advanced system catches bots with:
Cookies stop duplicate views and expire after 6 hours. They’re secure, HTTP-only, and don’t store personal data.
Yes! Style it with CSS classes like:
.ddd-post-views
for the view counter..ddd-top-posts-grid
for the grid container..ddd-top-post
for each post in the grid..ddd-post-excerpt
for excerpt text..ddd-post-thumbnail
for thumbnails..ddd-post-content
for the content wrapper.excerpt_length
and pick display="full"
for grids or display="minimal"
for lists.dddPostViews_POST_VIEWS_VERSION
, dddPostViews_PLUGIN_PATH
, dddPostViews_PLUGIN_URL
.