Advertisement
sgaffney

bbpress read more

Nov 3rd, 2011
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.20 KB | None | 0 0
  1. function wptumble_show_read_more( $content = '', $topic_id = 0, $args = array() ) {
  2.     global $bbp;
  3.     global $mar_options;
  4.  
  5.  
  6.     //default arguments
  7.     $defaults = array(
  8.         'separator' => '<hr />',
  9.         'before'    => '<div class="wptumble-mark-as-read">',
  10.         'after'     => '</div>'
  11.     );
  12.     $r = wp_parse_args( $args, $defaults );
  13.     extract( $r );
  14.  
  15.     //verify topic id, get author id, and mark as read
  16.     $topic_id   = bbp_get_topic_id          ( $topic_id );
  17.     $user_id    = bbp_get_topic_author_id   ( $topic_id );
  18.  
  19.     if(bbp_is_single_topic() && get_post_type() == 'topic' && $mar_options['show_links'] == true) {
  20.  
  21.         if($mar_options['post_position'] == 'Top') {
  22.             $content = mar_read_unread_links($mar_options[ 'read_text' ], $mar_options[ 'unread_text' ]) . $separator . $before . $content . $after;
  23.         } else {
  24.             $content = $content . $separator . $before . mar_read_unread_links($mar_options[ 'read_text' ], $mar_options[ 'unread_text' ]) . $after;
  25.         }
  26.  
  27.     }
  28.     return apply_filters( 'wptumble_show_read_more', $content, $topic_id, $separator );
  29.  
  30.  
  31. }
  32.  
  33. if ( !is_admin() ) {
  34.     add_filter( 'bbp_get_topic_content', 'wptumble_show_read_more', 1, 2 );
  35.     add_filter( 'bbp_get_topic_content', 'bbp_topic_content_append_revisions',      1, 4 );
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement