Notifications
Clear all

wpForo 1.x.x [Solved] Sub Forum Layout

11 Posts
4 Users
3 Likes
2,514 Views
Posts: 17
Topic starter
(@jwhit16)
Eminent Member
Joined: 4 years ago

Hi, I previously posted a topic on this and it appears to be closed.

I am considering purchasing 3-4 addons, but sub-forum layout is a major issue that may prevent me from moving forward.

Here is why. I plan to add 50-100 sub forums for each forum, they will be organized by location. So only 1, or possibly none of these sub forums will be relevant to a new user who wants to view the forum.

When that user clicks on a main forum, they will have to scroll past all 50-100 sub-forums to see the topics from the main forum.

Here is what it looks like with only 10 or so sub forums: https://gigsharks.com/community/delivery-amazon-flex/

I would like to offer a few potential solutions.

1) Show main forum content before sub-forums.

2) Enable a sub-forum drop down menu.

3) Enable sub-forum pagination.

All of these solutions benefit user experience for anyone using WP Foros. I am very pleased with the plugin overall, and hoping to invest in some add-ons. But unfortunately this is a major design flaw that I believe has enough negative impact on user experience to keep me from investing in additional add-ons.

If there is CSS that could accomplish any of the above resolutions please let me know.

Topic Tags
10 Replies
Robert
Posts: 10503
Admin
(@robert)
Support Team
Joined: 8 years ago
Posted by: @jwhit16

1) Show main forum content before sub-forums.

2) Enable a sub-forum drop down menu.

3) Enable sub-forum pagination.

Thank you for the suggestions @jwhit16,

We've added this in our to-do list. Currently, let's try to create the #2 using a simple custom code. But it'll look like this and it'll jump to selected sub-forum once you choose it:

 

 

Please follow the instruction below:

1. Put this function in your active WordPress theme functions.php file:

function wpforo_custom_subforum_dropdown(){
if( function_exists('WPF') ){
if ( WPF()->current_object['template'] == 'topic' && wpfval(WPF()->current_object, 'forum', 'url')
) {
$args = array( "parentid" => WPF()->current_object['forumid'], "type" => 'forum' );
if( $forums = WPF()->forum->get_forums( $args ) ){
?>
<div class="wpf-sub-wrap">
<select class="wpf-sub-forums" onchange="window.location = this.options[this.selectedIndex].value">
<option value="<?php echo esc_url_raw(WPF()->current_object['forum']['url']) ?>"><?php wpforo_phrase('Sub-Forums'); ?></option>
<?php
foreach ( $forums as $forum ){
if( WPF()->perm->forum_can( 'vf', $forum['forumid'] ) ) {
$forum_url = wpforo_forum( $forum['forumid'], 'url' );
echo '<option value="' . esc_url_raw( $forum_url ) . '">' . $forum['title'] . '</option>';
}
}
?>
</select>
</div>
<?php
}
}
}
}

 

2. Put this CSS code in Dashboard > Forums > Settings > Styles Tab > Custom CSS Code textarea. Save it, delete all caches and reset optimizer / minifier plugins cache if you have any:

#wpforo #wpforo-wrap.wpft-topic .cat-stat-questions,
#wpforo #wpforo-wrap.wpft-topic .cat-stat-answers,
#wpforo #wpforo-wrap.wpft-topic .cat-stat-posts{display:none;}
#wpforo #wpforo-wrap.wpft-topic .wpf-sub-wrap{width: 100%; background: #f5f5f5; padding: 10px; }
#wpforo #wpforo-wrap.wpft-topic .wpf-sub-forums{width: 90%; margin:0 auto 0px auto!important; display:block;}
#wpforo #wpforo-wrap.wpft-topic .forum-wrap {border-top: #cccccc 1px solid;display: none;}

 

3. Create an update-safe copy of wpForo Q&A layout forums.php file,

3.1 Create /wpforo/ folder in WordPress active theme directory,

3.2 Copy /wp-content/plugins/wpforo/wpf-themes/classic/forum.php file to the /wpforo/ folder,

3.3 Edit the copied /wpforo/forum.php file, find this part of code:

else : ?>
<p class="wpf-p-error">
<?php wpforo_phrase('No forums were found here.') ?>
</p>
<?php endif;

 

3.4. Add the new custom wpforo_custom_subforum_dropdown() function before that code. It should look like this:

wpforo_custom_subforum_dropdown();
else : ?>
<p class="wpf-p-error">
<?php wpforo_phrase('No forums were found here.') ?>
</p>
<?php endif;
1 Reply
(@jwhit16)
Joined: 4 years ago

Eminent Member
Posts: 17

@robert Thanks so much for the help I'll give this a try!

Posts: 17
Topic starter
(@jwhit16)
Eminent Member
Joined: 4 years ago

When I made these updates, subforums display in view of entire community. When I click on main forum in which I have sub forums, the sub forums disappear completely. 

It's actually not a bad layout for the time being, but I would be curious to see the drop-down. I have cleared cache through WP Rocket

1 Reply
Robert
Admin
(@robert)
Joined: 8 years ago

Support Team
Posts: 10503

@jwhit16,

What do you mean saying "on entire community? It should not be displayed on the home page.

The sub forums should only be displayed in the parent forum page. For example, when you're on the home page, and you click on a parent forum title and go that forum page, instead of the sub-forum list you should see only the drop-down as I showed it on the screenshot.

Please let me know whet template file have you used to insert the function? You should use the forum.php file directly in the /wpforo/wpf-themes/classic/ directory.

Can I see a screenshot of your change and copied file?

Posts: 17
Topic starter
(@jwhit16)
Eminent Member
Joined: 4 years ago

Thanks for your response. I was able to resolve after review. 

 

My only concern is whether I created the update safe copy correctly. I copied the forom.php part of the plugin and I have used File Manager in my hosting to create a WP Foro folder and save it under wp-content > themes. 

 

It is next to the folder I used for my child theme.

 

Is there a tutorial for this to check if I have saved correctly?

1 Reply
Robert
Admin
(@robert)
Joined: 8 years ago

Support Team
Posts: 10503

@jwhit16,

The /wpforo/ folder should be in the active child theme folder not next to.

Posts: 17
Topic starter
(@jwhit16)
Eminent Member
Joined: 4 years ago

I have followed these steps exactly. After adding /wpforo/ folder to child theme the changes have not been made.

The changes worked originally but it is not update proof, I lost changes on last update to plugin

Page 1 / 2