Advertisement
sgaffney

the_forum shortcode

Jan 12th, 2012
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.69 KB | None | 0 0
  1.     /** Forum shortcodes ******************************************************/
  2.  
  3.     /**
  4.      * Display an index of all visible root level forums in an output buffer
  5.      * and return to ensure that post/page contents are displayed first.
  6.      *
  7.      * @since bbPress (r3031)
  8.      *
  9.      * @param array $attr
  10.      * @param string $content
  11.      * @uses bbp_has_forums()
  12.      * @uses current_theme_supports()
  13.      * @uses get_template_part()
  14.      * @return string
  15.      */
  16.     public function display_forum_index( $attr ) {
  17.  
  18.         //Use the $tumbledata global to check for breadcrumbs inclusion
  19.         global $tumbledata;
  20.  
  21.         extract(shortcode_atts( array(  'breadcrumbs'   =>  'true',
  22.                         'recent_topics' =>  'true' ),
  23.         $attr));
  24.  
  25.         // Unset globals
  26.         $this->unset_globals();
  27.  
  28.         // Start output buffer
  29.         $this->start( 'bbp_forum_archive' );
  30.  
  31.         if($tumbledata['activate_breadcrumbs_block'] == 1) {
  32.  
  33.             if ( $breadcrumbs == 'true' ) {
  34.  
  35.                 // Get Primary Header
  36.                 bbp_get_template_part( 'bbpress/content',   'forum-header' );
  37.  
  38.             }
  39.  
  40.         }
  41.  
  42.         // Template notices
  43.         do_action( 'bbp_template_notices' );
  44.  
  45.         // Before forums index
  46.         do_action( 'bbp_template_before_forums_index' );
  47.  
  48.         // Load the forums index
  49.         if ( bbp_has_forums() )
  50.             bbp_get_template_part( 'bbpress/content', 'archive-forum' );
  51.  
  52.         // No forums
  53.         else
  54.             bbp_get_template_part( 'bbpress/feedback', 'no-forums'    );
  55.  
  56.         // After forums index
  57.         do_action( 'bbp_template_after_forums_index' );
  58.  
  59.         if($tumbledata['activate_topics_home_block'] == 1) {
  60.  
  61.             if ( $recent_topics == 'true' ) {
  62.  
  63.                 // List Topics
  64.                 bbp_get_template_part( 'bbpress/loop', 'topics-custom' );
  65.  
  66.             }
  67.  
  68.         }
  69.  
  70.         // Return contents of output buffer
  71.         return $this->end();
  72.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement