Search Results Item Header Info
I’m trying to add some detail to search results associated with replies to topics. By default, it would seem that if a search finds a hit in a particular topic post, it includes the name of the topic and the relevant forum in the header for the particular search result:
In contrast, a hit on a reply to a particular topic does not include any topic or forum information:
I thought I might be able to solve my problem by modifying the loop-search-reply.php template to include what looked like it might be the relevant code from the loop-search-topic.php template:
<div class="bbp-topic-title-meta"> <?php if ( function_exists( 'bbp_is_forum_group_forum' ) && bbp_is_forum_group_forum( bbp_get_topic_forum_id() ) ) : ?> <?php esc_html_e( 'in group forum ', 'bbpress' ); ?> <?php else : ?> <?php esc_html_e( 'in forum ', 'bbpress' ); ?> <?php endif; ?> <a>"><?php bbp_forum_title( bbp_get_topic_forum_id() ); ?></a> </div><!-- .bbp-topic-title-meta --> <?php do_action( 'bbp_theme_after_topic_title' ); ?>
but it seems that was a little naive of me. This block of code certainly includes what could be the required information: but what I thought would be inserted as the forum name turns out to be the topic name.
Looking at the above code, I can see why this might be—the relevant text, ‘bbpress’, in the code block above appears to be just some placeholder text, and is the same placeholder text used to reference the topic name. I had thought that the text replacement might be a little more context sensitive than it appears to be.
So my question is, can anyone tell me how that text (‘bbpress’ in the above code segment, which is taken directly from the default loop-search-topic.php template) gets replaced, or more specifically I guess, can anyone tell me where to inject a function or the like to set this or some other piece of placeholder text (I appreciate that it may need to be different to the placeholder text being used for the topic name) to the relevant forum name?
- You must be logged in to reply to this topic.