» Webmaster Forum

bbPress Formatierung

Ansicht von 1 Beitrag (von insgesamt 1)
  • Autor
    Beiträge
  • #4148 Reply
    Jochen Gererstorfer
    Keymaster
    Beiträge: 39

    bbPress ist eine Forumsoftware, die auf Einfachheit und Schnelligkeit getrimmt ist. Da gibt es viel zum Anpassen, wenn man damit auch glücklich sein möchte.

    bbPress Vorteile

    • perfekt in WordPress integriert
    • schnell

    bbPress Nachteile

    • Es fehlen viele typische Forumfunktionen
    • Entwicklung geht nur sehr langsam voran

    Auch ich habe hier im Webmaster Forum so einiges an bbPress angepasst. Allerdings wirklich nur, was unbedingt nötig war.

    Auf bbPress-Plugins möchte ich komplett verzichten. Lediglich bbPress Notify werde ich wohl installieren, damit ich über neue Threads und Posts informiert werde.

    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://j0e.org/forum/login/',
            );
        $items[] = (object) $item;
        }
      
        return $items;
    }
    add_filter( 'wp_nav_menu_objects', 'j0e_dynamic_submenu_logout_link', 10, 2 );
    
    // Add dropdown top the menu
    beans_add_attribute( 'beans_menu_item[_4180]', 'data-uk-dropdown', false );
    beans_add_attribute( 'beans_post_navigation', 'class', 'uk-grid-margin' );
    
    // 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
    }

    Falls du eigene coole Snippets für das bbPress Forum hast, würde ich mich freuen, wenn du sie heir mir uns teilst!

Ansicht von 1 Beitrag (von insgesamt 1)
Antwort auf: bbPress Formatierung
Deine Information:




Die besten

WP Themes

Ich empfehle dir eines dieser zwei Premium WordPress Themes.

Die besten

WP Themes

Ich empfehle dir eines dieser zwei Premium WordPress Themes.

Jochen Gererstorfer aka j0e
Nach oben scrollen