WP-Stats Shortcode

Below, you’ll find a detailed guide on how to add the WP-Stats Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the WP-Stats Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the WP-Stats Plugin and the shortcodes it provides:

Plugin Icon
WP-Stats

"WP-Stats is a powerful WordPress plugin that allows you to track and analyze your website's performance. It offers comprehensive data to help optimize your site for maximum engagement and conversions."

★★☆✩✩ (7) Active Installs: 4000+ Tested with: 6.2.3 PHP Version: false
Included Shortcodes:
  • [page_stats]

WP-Stats [page_stats] Shortcode

The ‘page_stats’ shortcode is a feature of the wp-stats plugin. It triggers a function that returns the statistics of a specific page. This shortcode is a helpful tool for monitoring page performance and visitor behavior.

Shortcode: [page_stats]

Examples and Usage

Basic example – A simple usage of the ‘page_stats’ shortcode without any parameters.

[page_stats /]

Advanced examples

Adding parameters to the ‘page_stats’ shortcode allows for more specific statistics. In this example, we’re specifying ‘post_id’ and ‘user_id’ parameters to get the statistics for a specific post and user.

[page_stats post_id="123" user_id="456" /]

In this next advanced example, we’re using the ‘date’ parameter to get the statistics for a specific date. Note that the date format should be ‘YYYY-MM-DD’.

[page_stats date="2022-01-01" /]

Lastly, you can combine multiple parameters to get more specific statistics. In this example, we’re getting the statistics for a specific post, user, and date.

[page_stats post_id="123" user_id="456" date="2022-01-01" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [page_stats] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('page_stats', 'stats_page_shortcode');

Shortcode PHP function:

function stats_page_shortcode($atts) {
    return stats_page();
}

Code file location:

wp-stats/wp-stats/wp-stats.php

Conclusion

Now that you’ve learned how to embed the WP-Stats Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *