Skip to:
Content
Pages
Categories
Search
Top
Bottom

Customizing lead topic


  • enkoes
    Participant

    @enkoes

    Hi, I’m using the codes below to show lead topic:

    function custom_bbp_show_lead_topic( $show_lead ) {
      $show_lead[] = 'true';
      return $show_lead;
    }
     
    add_filter('bbp_show_lead_topic', 'custom_bbp_show_lead_topic' );

    As shown in the screenshot below,

    https://paste.pics/MQEKW

    My questions are:
    a. Can I hide the header & footer (item 1) right above and below the lead topic?
    b. Can I change the date display (item 2) to freshness display (e.g., 2 weeks, 5 days ago) for all topics/replies?

    Regards.

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

  • Robin W
    Moderator

    @robin-w

    find
    wp-content/plugins/bbpress/templates/default/bbpress/content-single-topic-lead.php

    transfer this to your pc and edit
    that will let you remove the header and footer, and change the date function

    and save

    create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    Then transfer the file you saved above and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/content-single-topic-lead.php

    bbPress will now use this template instead of the original


    enkoes
    Participant

    @enkoes

    Yes, found it. I have deleted the header & footer part in the php file and put in my child theme.

    Does the date function look like this below?
    <span class="bbp-topic-post-date"><?php bbp_topic_post_date(); ?></span>

    May I know what is the freshness function so that I can replace it with?
    Other than lead topic, how about other replies? I want them to display freshness as well.

    Regards with thanks!


    Robin W
    Moderator

    @robin-w

    you can leave the template for time unchanged.

    add_filter ('bbp_get_topic_post_date' , 'rew_change_to_freshness', 10 , 6) ;
    add_filter ('bbp_get_reply_post_date' , 'rew_change_to_freshness', 10 , 6) ;
    
    function rew_change_to_freshness ($result, $topic_id, $humanize, $gmt, $date, $time) {
    	$result = bbp_get_time_since( bbp_convert_date( $time ) ) ;
    	
    return $result ;
    }

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets


    enkoes
    Participant

    @enkoes

    Thanks Robin! All topics & replies can already display freshness.

    One more thing about lead topic. I’d like to add a label like “Thread Starter” on top of the avatar of the topic starter for every reply (EXCEPT the lead topic) from the topic starter. In this case we will always keep track on who is the topic starter as the conversation goes on.

    It is similar to the screenshot below (from other WordPress forum):
    https://paste.pics/MRVM6

    Regards.


    Robin W
    Moderator

    @robin-w

    bbp style pack

    once activated go to

    dashboard>settings>bbp style pack>forum roles and you can set the topic author


    enkoes
    Participant

    @enkoes

    Hi, how if I wish to place the label on top of avatar so that it is easily identifiable? There is no such option in the bbp style pack.


    Robin W
    Moderator

    @robin-w

    in that tab there is the option ‘Where to show roles’ – it is the first item in that tab.


    enkoes
    Participant

    @enkoes

    Oh… yes. It’s done. Thanks man!

    I actually tried to change font of the label “Thread Starter” (under Topic Author) using Style Pack, but it seems not working at all. Any solution?


    Robin W
    Moderator

    @robin-w

    thanks – I’ll take a look at that


    Robin W
    Moderator

    @robin-w

    thanks, I found the issue – fixed in 5.4.3 just released.


    enkoes
    Participant

    @enkoes

    Recently I found that all freshness display all showing “sometime ago”.

    I came across a topic related to same issue Notifications – Date Received = “Sometime Ago”. It seems that the problem is related to time zone that makes this freshness display totally unworkable. If I don’t want to change to the actual display of date/time, any solution for this?

    Regards.


    Robin W
    Moderator

    @robin-w

    @enkoes – is this related to just lead topic, or does this need posting as a new topic?


    enkoes
    Participant

    @enkoes

    After checked, this is related to all replies, not just the lead topic affected.

    Within same topic, some replies that created few days ago shows “4 hours, 12 minutes ago” today. Other replies may show “sometime ago”. The freshness display seems like all mess up.

    eg,
    first post (lead topic): 10 hours, 51 minutes ago
    2nd reply: 2 hours, 36 minutes ago
    3rd reply: 15 hours, 52 minutes ago
    4th reply: 7 hours, 21 minutes ago
    5th reply: 16 hours, 27 minutes ago


    Robin W
    Moderator

    @robin-w

    so is this with this function installed?

    add_filter ('bbp_get_topic_post_date' , 'rew_change_to_freshness', 10 , 6) ;
    add_filter ('bbp_get_reply_post_date' , 'rew_change_to_freshness', 10 , 6) ;
    
    function rew_change_to_freshness ($result, $topic_id, $humanize, $gmt, $date, $time) {
    	$result = bbp_get_time_since( bbp_convert_date( $time ) ) ;
    	
    return $result ;
    }

    enkoes
    Participant

    @enkoes

    Yes sir.

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