Notifications
Clear all

[Solved] Show total number of subforum topics/posts on main forum

7 Posts
3 Users
3 Reactions
29.1 K Views
Posts: 4
Topic starter
(@dannymh2x)
Active Member
Joined: 1 year ago

Hi everyone,

I'm looking for a bit of help with my wpForo forum. I'm using the Simplified layout.

On the homepage, there is 4 forums with 3 of them having sub-forums. I have attached a screenshot.

Is there a way I can get it so those 3 forums show the total of topics and posts by counting their sub-forums too?

I have tried editing forum.php to include this code:

<?php $counts = wpforo_forum($cat['forumid'], 'counts'); ?>
<?php echo wpforo_print_number($counts['topics']) ?>

in replacing of this code:

<?php echo wpforo_print_number($forum['topics']) ?>

But this changed the topic count to be the same on each forum :/

I hope this makes sense and I look forward to a reply 🙂

Thanks.

6 Replies
Tutrix
Posts: 1431
(@tutrix)
Noble Member
Joined: 4 years ago

Hi @dannymh2x

you can display the counts separately in the Cat header

example

add this code in forum.php (layout 2)

<div class="wpf-cat-count"><?php $counts = wpforo_forum($cat['forumid'], 'counts'); ?><span class="wpf-topic-count" wpf-tooltip="<?php echo wpforo_print_number($counts['topics']) ?> Topics" wpf-tooltip-position="top" wpf-tooltip-size="medium"><i class="fas fa-layer-group"></i><?php echo wpforo_print_number($counts['topics']) ?></span> <span class="wpf-post-count" wpf-tooltip="<?php echo wpforo_print_number($counts['posts']) ?> Posts " wpf-tooltip-position="top" wpf-tooltip-size="medium"><i class="fas fa-list"></i><?php echo wpforo_print_number($counts['posts']) ?></span></div>

directly after

<div class="wpfl-2 wpforo-section">

and use this CSS code (example)

#wpforo #wpforo-wrap .wpf-cat-count {
  top: 50px;
  position: relative;
  padding: 5px 10px !important;
  font-size: 16px !important;
  margin-left: 20px !important;
  background: #fff;
  width: fit-content;
  border-radius: 5px;
}
#wpforo #wpforo-wrap .wpf-cat-count i {
  margin-right: 5px
}
#wpforo #wpforo-wrap .wpf-topic-count {
  margin-right: 10px !important;
}

looks like this (attachment) or in my forum 😉 

1 Reply
(@dannymh2x)
Joined: 1 year ago

Active Member
Posts: 4

@tutrix Hi there, thank you for this, it is much appreciated.

Before I try this, can I please just check that this will also update the numbers in the screenshot I've attached from "0" to the correct sub-forum topics and posts numbers?

Thank you.

BlackRaz
Posts: 406
Admin
(@blackraz)
Contributor
Joined: 8 years ago

Hi @dannymh2x ,

We apologize for any inconvenience. We have fixed the statistics display part in the Simplified Layout. Please stay updated with wpForo's new releases, and you will receive the fixed version in the next release.

3 Replies
(@dannymh2x)
Joined: 1 year ago

Active Member
Posts: 4

@blackraz Hi there, that's great, thank you for letting me know. Do you know if there is an estimated release for the next update? Thank you.

BlackRaz
Admin
(@blackraz)
Joined: 8 years ago

Contributor
Posts: 406

@dannymh2x 

Today, we have already released wpForo version 2.2.3

(@dannymh2x)
Joined: 1 year ago

Active Member
Posts: 4

@blackraz Thank you! 😀