Skip to content

Instantly share code, notes, and snippets.

@raftaar1191
Created October 15, 2019 09:17
Show Gist options
  • Save raftaar1191/041eab5c67638a97a34f4c0a9253c526 to your computer and use it in GitHub Desktop.
Save raftaar1191/041eab5c67638a97a34f4c0a9253c526 to your computer and use it in GitHub Desktop.
Add Main Forum title in Sub Menu fourms
<?php
/**
* Template part for displaying posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package BuddyBoss_Theme
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php //if ( !bbp_is_forum_archive() && !bbp_is_single_forum() && !bbp_is_single_topic() && !bbp_is_topic_archive() && !bbp_is_search() ) : ?>
<!--<header class="entry-header">-->
<?php //the_title( '<h1 class="entry-title">', '</h1>' ); ?>
<!--</header> .entry-header -->
<?php //endif; ?>
<?php
$class = '';
if( bbp_is_single_forum() && bbp_has_forums() ) {
$class = 'has-subforums';
}
?>
<?php if ( bbp_is_single_forum() ) :
global $post;
$post_parent_title = '';
if ( ! empty( $post->post_parent ) && $post->post_parent != $post->ID ) {
$post_parent_title = sprintf( '<a href="%s">%s</a> : ', get_the_permalink( $post->post_parent ), get_the_title( $post->post_parent ) );
}
?>
<header class="entry-header bb-single-forum <?php echo $class; ?>">
<?php the_title( '<h1 class="entry-title">' . $post_parent_title, '</h1>' ); ?>
</header> <!--.entry-header -->
<?php endif; ?>
<div class="entry-content">
<?php
the_content();
wp_link_pages( array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'buddyboss-theme' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<?php if ( get_edit_post_link() ) : ?>
<footer class="entry-footer">
<?php
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Edit <span class="screen-reader-text">%s</span>', 'buddyboss-theme' ), array(
'span' => array(
'class' => array(),
),
)
), get_the_title()
), '<span class="edit-link">', '</span>'
);
?>
</footer><!-- .entry-footer -->
<?php endif; ?>
</article>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment