Plugin Author
Steven
(@shazahm1hotmailcom)
@arnan de Gans
Sure, I’ll add it to my feature request. I could actually use that myself so it’ll likely come sooner than later.
Plugin Author
Steven
(@shazahm1hotmailcom)
@arnan de Gans
For regular commentors or forum moderators only? I’m leaning to the moderators only.
Thread Starter
Arnan
(@adegans)
What I need is that it works for everyone, perhaps you can make a checkmark in settings to make it optional to create a sense of security/control.
THanks for the quick replies!
Thread Starter
Arnan
(@adegans)
When do you think you can make an update?
Plugin Author
Steven
(@shazahm1hotmailcom)
@arnan de Gans
it’s on my to do list for March.
I’d love to see if for all forum members π
I added this code to functions.php/etc to turn backticks (just like used on the .org forums) into <pre lang=”PHP”>
/*
Switch <code></code> with <pre lang="PHP"></pre>
*/
function pmpro_code_wrap($content)
{
$content = preg_replace("/<code>(.*)</code>/s", '<pre lang="PHP">$1</pre>', $content);
return $content;
}
add_filter("the_content", "pmpro_code_wrap", -1);
I think it might not handle nested backticks properly, but is a start.
Yeah, even WP.org choked on that.
replace the code tags in the preg_replace line with backticks. I made a gist:
https://gist.github.com/strangerstudios/5556801
strangerstudios thanks for the tip, but your code is not working π I put it into wp-includes/functions.php, but wp-syntax highlighting still don’t work in bbpress forum posts! Could you help me?
I also didn’t understand what did you mean with “functions.php/etc”… ?
Thanks.
I figured it out!
I inserted this to the end to my template’s functions.php (if functions.php doesn’t exist, create it):
add_filter('bbp_get_reply_content', array("WP_Syntax", 'beforeFilter' ), 0);
add_filter('bbp_get_topic_content', array("WP_Syntax", 'beforeFilter' ), 0);
add_filter('bbp_get_reply_content', array("WP_Syntax", 'afterFilter' ), 99);
add_filter('bbp_get_topic_content', array("WP_Syntax", 'afterFilter' ), 99);
Plus, to the beginning of the file I copy’n’pasted the whole CUSTOM_TAGS block from the base functions.php of wordpress. Of course, with the modification at the pre tag:
'pre' => array(
'width' => true,
'lang' => true
),
If you need other paramters, you should add them.
Now I have fully functional wp-syntax highlighting in bbpress replies, too!