Skip to:
Content
Pages
Categories
Search
Top
Bottom

how to add span class bbp-topic-started-in


  • danceee3
    Participant

    @danceee3

    hello there!

    trying to setup a bbpress forum!

    i managed to create an homepage with the latest topics.

    I want to add the <span class=”bbp-topic-started-in”> (found this using chrome inspect) near the “started by” like it’s made here in the support forum!

    i think it’s rpetty crucial to show what forum the topic belong to, i have to idea where to start, any advice or pointer would be great

    thanks a lot!

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

  • danceee3
    Participant

    @danceee3

    noone knows? ;<


    Robkk
    Moderator

    @robkk

    The file you are looking for that has this code should be part of the templates you can customize if you copy the file loop-single-topic.php from the bbPress plugin to your child theme.


    danceee3
    Participant

    @danceee3

    ah thanks, the command is there, i tried to modify the syntax a bit but nothing shows up! can i get a little more details? thanks!


    Robkk
    Moderator

    @robkk

    You may need to refresh any cache if you cannot see any changes appear.

    The original code in loop-single-topic.php from \wp-content\plugins\bbpress\templates\default\bbpress\loop-single-topic.php

    Has this code. Which makes it not show up in single forum pages, so it is only visible in topics created section in your forum profile, forum search, and the topic archive on yoursite.com/topics. You may need to remove the conditional if you want to always have it visible.

    <?php if ( !bbp_is_single_forum() || ( bbp_get_topic_forum_id() !== bbp_get_forum_id() ) ) : ?>
    
    	<?php do_action( 'bbp_theme_before_topic_started_in' ); ?>
    
    		<span class="bbp-topic-started-in"><?php printf( __( 'in: <a href="%1$s">%2$s</a>', 'bbpress' ), bbp_get_forum_permalink( bbp_get_topic_forum_id() ), bbp_get_forum_title( bbp_get_topic_forum_id() ) ); ?></span>
    
    	<?php do_action( 'bbp_theme_after_topic_started_in' ); ?>
    
    <?php endif; ?>

    danceee3
    Participant

    @danceee3

    i cut the ifs but nothing happens, should have said this before, i am in no mean a programmer i did this

    <?php do_action( 'bbp_theme_before_topic_started_in' ); ?>
    
    		<span class="bbp-topic-started-in"><?php printf( __( 'in: <a href="%1$s">%2$s</a>', 'bbpress' ), bbp_get_forum_permalink( bbp_get_topic_forum_id() ), bbp_get_forum_title( bbp_get_topic_forum_id() ) ); ?></span>
    
    	<?php do_action( 'bbp_theme_after_topic_started_in' ); ?>

    is this correct?


    Robkk
    Moderator

    @robkk

    @danceee3

    Oh I forgot, put the customized loop-single-topic.php you have to a folder called bbpress in your child theme. bbPress should then use that file, and you should see the changes immediately.


    danceee3
    Participant

    @danceee3

    oh thanks i thought it was optional! tanks for the help!

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