LMD (@louisedade)

Forum Replies Created

Viewing 2 replies - 51 through 52 (of 52 total)

  • LMD
    Participant

    @louisedade

    Ahhh, pieces fall into place! I’m using the ‘path-to-url’ fix plugin and see that it uses the following filter to replace the ‘ bb_path_to_url’ function:

    add_filter( ‘bb_path_to_url’, ‘fix_bb_path_to_url’, 1, -1 );

    So that is the syntax I’m looking for (obviously replacing the functions I need).

    Looking at the ‘add_filter’ function, I can work out that ‘1’ sets the priority and ‘-1’ is a boolean flag indicating whether the new function accepts arguments.

    Would I be right in saying that by setting the new function to a priority of ‘1’ means it overwrites the old function?

    If so, then does setting it with a lower priority (e.g. ‘2’) makes it run after the old function and before any other functions, as if extending the function?

    Just had to edit this post, which gives me another idea: a ‘Preview’ button! Maybe ‘preview in place’ using the DOM, like some WP comments sections.


    LMD
    Participant

    @louisedade

    Well, I got it working, but it uses a hack rather than a plugin. It wasn’t too hard, I guess I could document the hack until such time as I work out how to make it a plugin.

    The thing I don’t quite ‘get’ yet (not having made a plugin for either WordPress or bbPress before) is how to modify the behaviour of an existing function. If I write my own version of a function, will it overwrite the existing function?

Viewing 2 replies - 51 through 52 (of 52 total)