Show forum statistics in other places
I would like to be able to show the forum statistics on non-forum pages, and also possibly in a widget on a sidebar. Is this possible? If so how?
Thanks in advance.
ooooh that would be cool 🙂
You should use this function in template files:
<?php $stat = WPF()->statistic(); ?>
The $stat is an array of all stat data.
<?php echo 'Forums: ' . $stat['forums']; ?>
<?php echo 'Topics: ' . $stat['topics']; ?>
<?php echo 'Posts: ' . $stat['posts']; ?>
<?php echo 'Members: ' . $stat['members']; ?>
<?php echo 'Online Users: ' . $stat['online_members_count']; ?>
<?php echo $stat['last_post_title']; ?>
<?php echo $stat['last_post_url']; ?>
And how would I make this show only on particular pages?
You would need to create or edit a WordPress page template and use the code that Robert provided.