bbPress Formatierung

bbPress Design and Formatting

bbPress is a forum software that is trimmed for simplicity and speed. There is a lot to customize if you want to be happy with it too.

bbPress advantages

  • integrated perfectly into WordPress
  • fast

bbPress disadvantages

  • Lacks many typical forum functions
  • Development is very slow

Also I have already adapted some bbPress forums. But really only what was absolutely necessary.

I would like to do without bbPress plugins completely. Only bbPress Notify is important to inform the admin about new threads and posts.

CSS:

#bbpress-forums {
	font-size: 14px;
}

#bbpress-forums .bbp-body div.bbp-reply-content {
    background-color: #fff !important;
    padding: 8px !important;
}

// font size sub-forums list
#bbpress-forums .bbp-forums-list li {
	font-size: 12px !important;
}

// Button background-color
#bbpress-forums div.bbp-the-content-wrapper input, #bbpress-forums .wp-media-buttons button, .wp-core-ui .button, .wp-core-ui .button-secondary, .wp-core-ui .button:hover {
	background-color: #444;
    min-height: 32px !important;
    padding: 0 10px !important;
}

// Editor styling
#bbpress-forums div.bbp-the-content-wrapper textarea.bbp-the-content {
	font-size: 14px !important;
	height: 320px;
	line-height: 22px !important;
}

// Table header titles
#bbpress-forums li.bbp-header, #bbpress-forums li.bbp-footer {
    color: #009999 !important;
}

// avatar styling
#bbpress-forums .widget_display_replies img.avatar, #bbpress-forums .widget_display_topics img.avatar, #bbpress-forums div.bbp-template-notice img.avatar, #bbpress-forums p.bbp-topic-meta img.avatar, #bbpress-forums ul.bbp-reply-revision-log img.avatar, #bbpress-forums ul.bbp-topic-revision-log img.avatar {
    margin-bottom: unset !important;
    border: unset !important;
    width: 20px !important;
    height: 20px !important;
}

// Avatar circle
.avatar {
	border-radius: 50%;
}

// Full width for some text fields
.bbp-form input[type="text"], .bbp-form input[type="password"] {
	width: 100%;
}

functions.php:

<?php
// List sub-forums vertical and remove counters
add_filter('bbp_before_list_forums_parse_args', 'j0e_bbpress_list_forums' );
function j0e_bbpress_list_forums() {
     $args['before']           = '<ul class="bbp-forums-list">';
     $args['after']            = '</ul>';
     $args['link_before']      = '<li class="bbp-forum">';
     $args['link_after']       = '</li>';
     $args['count_before']     = ' (';
     $args['count_after']      = ')';
     $args['count_sep']        = ', ';
     $args['separator']        = '<br />';
     $args['forum_id']         = '';
     $args['show_topic_count'] = false;
     $args['show_reply_count'] = false;
     return $args;
}

// Function to shorten freshness display from say '1 month, 2 weeks' to '1 month'
function j0e_short_freshness_time( $output) {
	$output = preg_replace( '/, .*[^ago]/', ' ', $output );
	return $output;
}
add_filter( 'bbp_get_time_since', 'j0e_short_freshness_time' );
add_filter( 'bp_core_time_since', 'j0e_short_freshness_time' );

// Allow upload media in bbPress
add_filter( 'bbp_after_get_the_content_parse_args', 'j0e_bbpress_upload_media' );
function j0e_bbpress_upload_media( $args ) {
     $args['media_buttons'] = true;
     return $args;
}

// Never show admin bar
add_filter('show_admin_bar', '__return_false');

// Add Recent Topics to BBPress
function j0e_recent_bbpress_topics() {
	if ( bbp_has_topics( array( 'author' => 0, 'show_stickies' => false, 'order' => 'DESC', 'post_parent' => 'any', 'posts_per_page' => 5 ) ) )
	bbp_get_template_part( 'bbpress/loop', 'topics' );
}
add_action('bbp_template_before_forums_index','j0e_recent_bbpress_topics');

// This function hooks to BBpress loop-single-reply.php and adds the post count to the reply display
function j0e_display_count ()
    {
        $post_count = bbp_get_user_post_count( bbp_get_reply_author_id( $reply_id ));
        echo "Beiträge: ";
        echo $post_count;
        echo "";
    }
add_action ('bbp_theme_after_reply_author_details', 'j0e_display_count');

// Register bbpress widget area
add_action( 'widgets_init', 'j0e_register_bbpress_widget_area' );

function j0e_register_bbpress_widget_area() {

	beans_register_widget_area( array(
        'name' => 'bbPress',
        'id' => 'bbp-sidebar',
        'description' => 'A sidebar that only appears on bbPress pages.'
	) );

}

// Add the bbpress widget area
add_action( 'beans_sidebar_primary', 'j0e_bbpress_widget_area' );

function j0e_bbpress_widget_area() {

	// Stop here if no widget
	if( !beans_is_active_widget_area( 'bbp-sidebar' ) )
		return;

	if ( is_active_sidebar( 'bbp-sidebar' ) && is_bbpress() || is_page_template( 'bbpress.php' ) ) {
		?><section class="uk-block">
			<div class="class=uk-container uk-container-center">
				<?php echo beans_widget_area( 'bbp-sidebar' ); ?>
			</div>
		</section><?php
	}

}

// Dynamically add a sub-menu item to an existing menu item in wp_nav_menu
function j0e_dynamic_submenu_logout_link( $items, $args ) {
  
    $theme_location = 'primary';
    $existing_menu_item_db_id = 4180;
     
    if ( $theme_location !== $args->theme_location ) {
        return $items;
    }
    $new_links = array();
  
    if ( is_user_logged_in() ) {
        $item = array(
            'title'            => 'Log out',
            'menu_item_parent' => $existing_menu_item_db_id,
            'ID'               => 'log-out',
            'db_id'            => '99954',
            'url'              => wp_logout_url(get_permalink()),
        );
    $items[] = (object) $item;
    }
    else {
        $item = array(
            'title'            => 'Log in',
            'menu_item_parent' => $existing_menu_item_db_id,
            'ID'               => 'login',
            'db_id'            => '99955',
            'url'              => 'https://bloggerpilot.com/forum/login/',
        );
    $items[] = (object) $item;
    }
  
    return $items;
}
add_filter( 'wp_nav_menu_objects', 'j0e_dynamic_submenu_logout_link', 10, 2 );

// Add carret down icon to the menu
add_action( 'beans_menu_item_link[_4180]_append_markup', 'j0e_add_carret_down' );
function j0e_add_carret_down() {
    ?>
    <i class="uk-icon-caret-down uk-margin-small-left"></i>
    <?php
}

Update 05/29/22: Removed theme-specific functions.

Best WordPress Hosting

Hosting recommendations are usually garbage.

Often extremely cheap hosting packages for $ 3 are recommended, others advertise a $ 100 VPS, because they earn the most as an affiliate thereby. In the end, we all just want the fastest possible web space for as little money as possible.

And optimized for WordPress!

What else is important? The server should be a fast backbone for your website and the support should answer as fast as possible, and preferably in your language.

You can get all this at Cloudways from $ 10,00 / month.

If you have any cool snippets of your own for the bbPress forum, I’d love for you to share them here! Just post them in the comments.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *