Skip to:
Content
Pages
Categories
Search
Top
Bottom

overriding bbpress template-tag function


  • Robin W
    Moderator

    @robin-w

    I hope this has a very simple solution.

    I need to either stop a BBpress template-tags function from happening, or over-ride it with a new one, but want to do this from a plugin, rather than amending BBpress code.

    Is there a line of code that simply stops a function within BBpress, or a quick way to overwrite one using a plugin.

    More detail below

    I want to revise the bbp_single_topic_description which is currently used in content-single-topic.php to show the phrase “This topic contains 2 replies, has 2 voices etc.” below a post

    The bbp_single_topic_description is defined in /includes/topics/template-tags.php

    I have written a pluggin that creates a new function, and uses the bbp_template_before_single_topic action hook in content-single-topic.php to display the new wording .

    ie

    add_action( 'bbp_template_before_single_topic',  'btv_single_topic_description');
    function btv_single_topic_description( $args = '' ) {
    	CODING STUFF;
    	}

    But I need to stop the old wording displaying as well as this.

    I have three approaches

    1. Just comment out the appropriate line in content-single-topic.php – simple to do, but of course gets overwritten by new releases
    2. Do something in the plugin that stops bbp_single_topic_description from working using code within my plugin – if this is easy, that is what I’d like to do, but as the function doesn’t have an action hook as far as I know, I don’t know how to remove it.
    3. Do something to make my function replace/overwrite the bbpress function, so that I don’t have to hook it anywhere?

    Can anyone help me with either 2 or 3 – I hope it’s an easy answer, but am stumped !

Viewing 1 replies (of 1 total)

  • yanseo
    Participant

    @yanseo

    +1 for this as I’m also trying to remove the avatar from the same line which I know how but editing the core file isn’t advisable.

    Have you found the right way to do it via function that will overwrite the bbpress template-tag function?

    Thanks!

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