Skip to content

Instantly share code, notes, and snippets.

@ntwb
Created December 3, 2013 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ntwb/7764534 to your computer and use it in GitHub Desktop.
Save ntwb/7764534 to your computer and use it in GitHub Desktop.
bbPress - Custom BBCode Table Replace
<?php
/*
Plugin Name: bbPress - Custom BBCode Table Replace
Plugin URI: https://gist.github.com/ntwb/7764534
Description: bbPress - Custom BBCode Table Replace
Version: 0.1
Author: Stephen Edgar - Netweb
Author URI: http://netweb.com.au
*/
function ntwb_custom_bbcode_table_replace( $text ) {
$text = preg_replace( '/\[bbcode_table\]/i', htmlspecialchars_decode( '<table>' ), $text);
$text = preg_replace( '/\[\/bbcode_table\]/i', htmlspecialchars_decode( '</table>' ), $text);
$text = preg_replace( '/\[bbcode_table_tr\]/i', htmlspecialchars_decode( '<tr>' ), $text);
$text = preg_replace( '/\[\/bbcode_table_tr\]/i', htmlspecialchars_decode( '</tr>' ), $text);
$text = preg_replace( '/\[bbcode_table_td\]/i', htmlspecialchars_decode( '<td>' ), $text);
$text = preg_replace( '/\[\/bbcode_table_td\]/i', htmlspecialchars_decode( '</td>' ), $text);
return $text;
}
add_filter('bbp_get_reply_content', 'ntwb_custom_bbcode_table_replace');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment