Skip to:
Content

bbPress.org


Ignore:
Timestamp:
04/03/2012 08:53:38 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Add classes to bbp_get_forum_class():

  • Add 'bbp-has-subforums' if forum has subforums
  • Add 'loop-item-%' for each item in the loop
  • Split code up into easier to grok chunks
  • Fixes #1803
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-forum-template.php

    r3823 r3831  
    17591759        $count     = isset( $bbp->forum_query->current_post ) ? $bbp->forum_query->current_post : 1;
    17601760        $classes   = array();
    1761         $classes[] = ( (int) $count % 2 )                 ? 'even'            : 'odd';
    1762         $classes[] = bbp_is_forum_category( $forum_id )   ? 'status-category' : '';
    1763         $classes[] = 'bbp-forum-status-' . bbp_get_forum_status( $forum_id );
     1761
     1762        // Get some classes
     1763        $classes[] = 'loop-item-' . $count;
     1764        $classes[] = ( (int) $count % 2 )                      ? 'even'              : 'odd';
     1765        $classes[] = bbp_is_forum_category( $forum_id )        ? 'status-category'   : '';
     1766        $classes[] = bbp_get_forum_subforum_count( $forum_id ) ? 'bbp-has-subforums' : '';
     1767        $classes[] = bbp_get_forum_parent_id( $forum_id )      ? 'bbp-parent-forum-' . bbp_get_forum_parent_id( $forum_id ) : '';
     1768        $classes[] = 'bbp-forum-status-'     . bbp_get_forum_status( $forum_id );
    17641769        $classes[] = 'bbp-forum-visibility-' . bbp_get_forum_visibility( $forum_id );
    1765         $classes[] = bbp_get_forum_parent_id( $forum_id ) ? 'bbp-parent-forum-' . bbp_get_forum_parent_id( $forum_id ) : '';
     1770
     1771        // Ditch the empties
    17661772        $classes   = array_filter( $classes );
    17671773        $classes   = get_post_class( $classes, $forum_id );
     1774
     1775        // Filter the results
    17681776        $classes   = apply_filters( 'bbp_get_forum_class', $classes, $forum_id );
    17691777        $retval    = 'class="' . join( ' ', $classes ) . '"';
Note: See TracChangeset for help on using the changeset viewer.