Notifications
Clear all

wpForo 1.x.x [Solved] show Number of views below subscribe button

6 Posts
2 Users
2 Reactions
1,035 Views
netvilox
Posts: 64
Topic starter
(@netvilox)
Estimable Member
Joined: 5 years ago

Please I need a code to show Number of views below the subscribe button. As shown in the picture below. It will look likeΒ 

345Β viewsΒ 

Topic Tags
5 Replies
Robert
Posts: 10587
Admin
(@robert)
Support Team
Joined: 9 years ago

Hi @netvilox,

The number of views is not counted for forums. It's only counted for topics. Each topic has its number of views. I'm sorry but there is no total number of views in wpForo.

1 Reply
netvilox
(@netvilox)
Joined: 5 years ago

Estimable Member
Posts: 64

@robert

Thanks for your reply sir, but what I mean is how to show Number of views a topic has below its subscribe button. See image below 

netvilox
Posts: 64
Topic starter
(@netvilox)
Estimable Member
Joined: 5 years ago

Just like its done on this forumΒ 

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

Hi @netvilox,

You can do this in update safe way by customizing wpForo post.php template file.

1. Create /wpforo/ folder in your WordPress active theme folder, if you have child theme in the child folder.

2. Copy /wp-content/plugins/wpforo/wpf-themes/classic/post.php file to just created /wpforo/ folder. Use some FTP client or your hosting service File Manager.

3. Edit the post.php, find this code line:

<div class="wpf-action-link"><?php WPF()->tpl->topic_subscribe_link() ?></div>

4. Add this code below that line:

<div class="wpf-topic-views"><?php echo __('Topic Views', 'wpforo') . ': ' . number_format($topic['views']); ?></div>

Β 

The documentation: https://wpforo.com/docs/root/forum-themes/theme-customization/

Β 

netvilox
Posts: 64
Topic starter
(@netvilox)
Estimable Member
Joined: 5 years ago

Thank you very much sir you and WPforo teams are always here to help us out anytime. The code worked thanks you very much sir, am so happy.Β