Skip to:
Content
Pages
Categories
Search
Top
Bottom

Third-party shortcodes in bbPress posts


  • yo35
    Participant

    @yo35

    Hi,
    Is it possible to use WordPress shortcodes in bbPress posts? (I mean either native WordPress shortcodes such as [caption][/caption], [gallery ...], or shortcodes defined by third-party plugins).
    To be more precise, I’m the author of a WordPress plugin that allows to insert chess diagrams and/or chess games in WordPress posts/pages (see https://wordpress.org/plugins/rpb-chessboard/). I would like to extend to have chess games/diagrams in bbPress posts.
    Thank you beforehand.

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

  • Robin W
    Moderator

    @robin-w

    This used to work, see no reason why it should not still be fully functional!

    https://wordpress.org/plugins/bbpress-do-short-codes/


    Robin W
    Moderator

    @robin-w

    you may need to add this to your functions file to get it for particpants

    add_filter (‘pw_bbp_parse_shortcodes_cap’ , ‘publish_topics’ ) ;


    Martin
    Participant

    @lamanodesuarez

    Hi!, I need to do this in my wordpress. I’ver already installed rpb-chessboard and bbpress-do-short-codes plugins, but i don’t know where i have to call function
    add_filter (‘pw_bbp_parse_shortcodes_cap’ , ‘publish_topics’ ) ;

    When I active bb-press-do-shot-codes [pgn] and [fen] sections were disappeard.

    Thanks!


    yo35
    Participant

    @yo35

    @Robin W: thanks for your answers. The “bbPress – Do Short Codes” plugin do the job.

    However, there is still a problem: bbPress seems to have a kind of postprocessing that adds several <p></p> tags within the post content, including the sections that result from shortcode processing. Is it possible to disable this behavior?


    yo35
    Participant

    @yo35

    @Martin: there is a workaround for the [fen] sections in the last version of RPB Chessboard. But [pgn] sections still do not work.


    Chad R. Schulz
    Participant

    @chadschulz

    @yo35: It can be done. But, you’ll need to either mod the plugin or insert a custom function inside your child theme (while deactivating the plugin to avoid conflicts).

    the original plugin code is:

    function pw_bbp_shortcodes( $content, $reply_id ) {
    	
    	$reply_author = bbp_get_reply_author_id( $reply_id );
    
    	if( user_can( $reply_author, pw_bbp_parse_capability() ) )
    		return do_shortcode( $content );
    
    	return $content;
    }
    add_filter('bbp_get_reply_content', 'pw_bbp_shortcodes', 10, 2);
    add_filter('bbp_get_topic_content', 'pw_bbp_shortcodes', 10, 2);
    
    function pw_bbp_parse_capability() {
    	return apply_filters( 'pw_bbp_parse_shortcodes_cap', 'publish_forums' );
    }

    What needs to change is the section returning the do_shortcode( $content ) as follows:

    	if( user_can( $reply_author, pw_bbp_parse_capability() ) ) {
    		$content = shortcode_unautop( $content );
    		return do_shortcode( $content );
    	}

    This will remove the autop filter that adds <p></p> to the shortcode text.

    Good luck.


    Martin
    Participant

    @lamanodesuarez

    Hi @chadschulz. I Tried with that code but it didn’t work with [pgn] and the chessboard plugin.

    @yo35
    any Idea?

    Thanks a lot!


    meetarnav
    Participant

    @meetarnav

    Was this ever resolved. I have the same combination RPB and bbPress. The codes work for Keymaster but not foe Participant. Also, they don’t show pgn and fen as tags in the options on the editor – one has to type them in manually.


    Robin W
    Moderator

    @robin-w

    no idea what ‘RPB ‘ is ? link to the plugin please


    meetarnav
    Participant

    @meetarnav

    It’s the plugin mentioned by its author in the topic – RPB Chessboard. Link is there…!

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