#1 WordPress forum plugin created by gVectors Team

wpForo – WordPress Forum Plugin
  • Home
  • Forum
  • Migrate to wpForo
  • Addons
  • Addons Demo
  • Documentation

Forum

Home | Forum

wpDiscuz - WordPress Comment Plugin
  • Forums
  • Members
  • Recent Posts
Forums
Main Support Forums
How-to and Troubles...
Sidebar left on mob...
 
Share:
Share
Tweet
Share
Notifications
Clear all

Script [Solved] Sidebar left on mobile

    Last Post
RSS

Macky
Posts: 774
 Macky
Topic starter
January 5, 2022 10:06 pm
(@percysgrowroom)
Prominent Member
Joined: 3 years ago

I have asked this before and cant find the thread..... But on mobile, I would like the side bar to show before the main forum. So my recent posts.ย 

I would be good if i could just add one widget like "recent post" on top of the forum on mobile. So the members can see recent posts and not the whole side bar. It is a pain to scroll passed the whole forum to get to the widgets....

ย 

Any idea how to fix this?

Forum Page URL
https://percysgrowroom.com

Check out my Wpforo forum, lots of customisations and add ons ๐Ÿ™‚
Percys Grow Room

Topic Tags
forum sidebar top sidebar custom sidebar sidebar
2 Replies
Robert
Posts: 8959
Robert - Twitter
 Robert
Admin
January 6, 2022 7:47 am
(@robert)
Support Team
Joined: 6 years ago

Hi @percysgrowroom,

I think you should use this plugin, put the widget before the shortcode in the forum page editor:

https://wordpress.org/plugins/amr-shortcode-any-widget/

You should contact this plugin developers and ask them to help you to only show this widget on mobile pages.

ย 

Or you can put this code into the functions.php of your current active WordPress theme. This will add new sidebar in Dashboard > Appearance > Widgets admin page, so the widgets in this sidebar will be only displayed on the forum top area on mobile devices:

function wpforo_custom_sidebar() {
register_sidebar( array(
'name' => __( 'Forum Top Mobile Sidebar', 'textdomain' ),
'id' => 'mobile-sidebar',
'description' => __( 'Widgets in this area will be shown on forum top for mobile only.', 'wpforo' ),
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'wpforo_custom_sidebar' );


function wpforo_custom_sidebar_area() {
if( function_exists('is_wpforo_page') && is_wpforo_page() ){
if ( !is_active_sidebar( 'mobile-sidebar' ) || !wp_is_mobile() ) return;
echo '<div class="wpforo-top-sidebar">';
dynamic_sidebar( 'mobile-sidebar' );
echo '</div>';
}
}
add_action( 'wpforo_top_hook', 'wpforo_custom_sidebar_area' );

BTW, you can use Code Snippets plugin to add custom codes.

In case you want to say thank you !)
We'd really appreciate and be thankful if you leave a good review on plugin page. This is the best way to say thank you to this project and support team.

Reply
VereK liked
VereK
Posts: 321
 VereK
January 8, 2022 4:14 am
(@verek)
Reputable Member
Joined: 4 years ago

This is fantastic @robert. Only small change I would make is H2 class the same as the normal sidebars (widget-title) so that any styling css that we may have done is uniform.

Reply
Robert liked
  All forum topics
  Previous Topic
Next Topic  
Related Topics
  • Sidebar widgets overlap each other
    2 years ago
  • Hide forum menu and forum sidebar
    2 years ago
  • Other Widgets In Sidebar
    3 years ago
  • Turn off right side bar
    3 years ago
Topic Tags:  forum sidebar (2), top sidebar (2), custom sidebar (1), sidebar (18),

Forum Search

Join Us!

Download wpForo plugin
on WordPress.org

wpForo Addons

wpforo-private-messages wpforo-advanced-attachments-128x128 wpforo-embeds-128x128 wpForo User Custom Fields addon wpForo โ€“ Blog Cross Posting addon wpForo Ads Manager wpForo โ€“ WooCommerce Memberships Integration wpForo Emoticons wpForo โ€“ Tenor GIFs Integration
View all Addons ยป

Recent Topics

  • Can't send confirmation email from topics when suscribe for new topic

    By gilbau, 2 hours ago

  • Can't add shortcodes to wpForo

    By avorai, 2 hours ago

  • New Feature H1 title for tags

    By annushka, 16 hours ago

  • File in antisapm protection not deleted

    By pesimist57, 22 hours ago

  • How to make URL dynamic like - post1233

    By kedy, 23 hours ago

  • Error 2253 Root Cause

    By aaronmckeon, 2 days ago

Topic Tags

  • translation49
  • css49
  • plugin conflict48
  • seo46
  • new features44
  • buddypress42
  • forum41
  • ultimate member40
  • avatar40
  • moderation38
  • login38
  • registration36
  • threaded layout35
  • cache33
  • editor32
  • menu32
  • shortcode31
  • spam29
  • phrases28
  • forum accesses28
View all tags (2161)

Recent Posts

  • Answer to: Can users be in multiple forums?

    @Chris Thanks so much for clarifying and the links. Doe...

    By monimair, 19 mins ago

  • RE: wpForo 2 Major Update is Imminent!

    I would like to be added to the beta test as I am worki...

    By laurenceliew, 57 mins ago

  • Can't send confirmation email from topics when suscribe for new topic

    When a user click on "Subscribe for new topic" a warnin...

    By gilbau, 2 hours ago

  • RE: Can't add shortcodes to wpForo

    Second image for reference  image-1.png

    By avorai, 2 hours ago

  • RE: File in antisapm protection not deleted

    @chris Thank you for your help.The problem is actual...

    By pesimist57, 13 hours ago

  • H1 title for tags

    Hello! Check attached pdf report please. Can you add ...

    By annushka, 16 hours ago

  • RE: Show Likers with their avatar

    Hi @chris thanks for your helpbut what do you mean b...

    By Tutrix, 18 hours ago

Share:
Share
Tweet
Share
  Forum Statistics
20 Forums
9,753 Topics
49.4 K Posts
5 Online
43.4 K Members

Latest Post: Can users be in multiple forums? Our newest member: Sanders69 Recent Posts Unread Posts Tags

Forum Icons: Forum contains no unread posts Forum contains unread posts

Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Powered by wpForo | Copyright ยฉ 2016-2022 gVectors Team
Copyright Registration Service - Click here for more information or to register work
wpForo is Registered with the IP Rights Office
Copyright Registration Service

Ref: 4477265538
  • Home
  • Forum
  • Migrate to wpForo
  • Addons
  • Addons Demo
  • Documentation