Notifications
Clear all

wpForo 1.x.x [Closed] Show forum statistics in other places

10 Posts
3 Users
3 Reactions
2,757 Views
Posts: 237
Topic starter
(@mrsamg)
Reputable Member
Joined: 8 years ago

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.

9 Replies
Wendell
Posts: 242
(@wendell)
Reputable Member
Joined: 7 years ago

ooooh that would be cool 🙂

1 Reply
(@mrsamg)
Joined: 8 years ago

Reputable Member
Posts: 237

Yes, indeed. I am building a private paid forum but would like to show the stats on a public page to draw new members in.

Robert
Posts: 10587
Admin
(@robert)
Support Team
Joined: 9 years ago

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']; ?>
Posts: 237
Topic starter
(@mrsamg)
Reputable Member
Joined: 8 years ago

And how would I make this show only on particular pages?

Wendell
Posts: 242
(@wendell)
Reputable Member
Joined: 7 years ago

You would need to create or edit a WordPress page template and use the code that Robert provided.

Page 1 / 2