Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add large avatar next to topic in one forum only


  • demonboy
    Participant

    @demonboy

    Hi,

    I have a forum called ‘Introduce Yourself’. Currently the topic archive page on all forums just shows the topic title and a small ‘started by’ avatar underneath. This is fine for most forums but I’d like to show a large avatar to the left of the topic title in the Introduce Yourself forum only.

    I found this thread on a similar subject but I’m not sure how to make this work for this one forum only.

    Any pointers?

Viewing 3 replies - 1 through 3 (of 3 total)

  • Robin W
    Moderator

    @robin-w

    if that code does what you want then just use the same logic you did in

    How to reorder topics in one forum?

    eg

    function rkk_topic_av() {
    
    $thisforumid = bbp_get_forum_id();
    
      if($thisforumid == 43135) {
    
    	    	echo bbp_get_topic_author_link( array( 'size' => '48' , 'type' => 'avatar'));
    }
    }
    add_action('bbp_theme_before_topic_title','rkk_topic_av');

    demonboy
    Participant

    @demonboy

    Yep, that’s great. Thanks again, Robin.

    If anyone else is interested, in addition to the above code placed in functions.php, I amended loop-single-topic.php in my child theme thus:

    		<a class="bbp-topic-permalink" href="<?php bbp_topic_permalink(); ?>"><?php bbp_topic_title(); ?>
    <?php $forum_id = bbp_get_forum_id(); 
        if (( $forum_id == 41371) ){
    			?>
     - <?php echo bbp_get_topic_author(); ?></a>		
    <?php
        }
    
    else {?>		
    		</a>
    <?php
    }?>
    		<?php do_action( 'bbp_theme_after_topic_title' ); ?>
    
    		<?php bbp_topic_pagination(); ?>
    
    		<?php do_action( 'bbp_theme_before_topic_meta' ); ?>
    
    		<p class="bbp-topic-meta">
    
    			<?php do_action( 'bbp_theme_before_topic_started_by' ); ?>
    <?php $forum_id = bbp_get_forum_id(); 
        if (( $forum_id == 41371) ){
    			?>
    <?php
        }
    
    else {?>
    			<span class="bbp-topic-started-by"><?php printf( __( 'Started by: %1$s', 'bbpress' ), bbp_get_topic_author_link( array( 'size' => '14' ) ) ); ?></span>
    <?php
    }?>

    This selects a specific forum and within that forum it removes the ‘started by’ meta info that normally appears under the title. Instead it places the topic author’s display name (not user name) as an extension of the topic title, separated by a hyphen. The link to the author is removed and instead becomes part of the link to the topic.


    Robin W
    Moderator

    @robin-w

    great glad you are fixed

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar