Notifications
Clear all

wpForo 1.x.x [Closed] wpForo and SyntaxHighlighter Evolved

21 Posts
5 Users
5 Reactions
5,137 Views
labradorman
Posts: 11
Topic starter
(@labradorman)
Active Member
Joined: 7 years ago

Hi,

I would love to make my webboard as a community for programmers; therefore, I would love to make the SyntaxHighlighter Plugin (or other similar plugins) be usable in wp-foro.

I have followed the previous 2 suggestions without sucess:

1. https://wpforo.com/community/how-to-and-troubleshooting-2/how-to-use-wpforo-with-syntaxhighlighter-evolved/

Here, I successfully copied the layouts folder to the destination /wpforo/layouts/1/post.php , but there is no line containing the following code as suggested. (is it due to wpforo update?)

<?php echo wpforo_content_filter( wpforo_kses($post['body'], 'post') ) ?>

2. this suggestion : 
https://wpforo.com/community/general-discussions/quick-comparison-to-smf-and-mybb/#post-16371

However, in Dashboard > Forums > Settings > Features admin page , there is no option to enable the highlighter plugins.

Could you please kindly suggest ?

Best Regards,

20 Replies
Sofy
Posts: 4802
 Sofy
Admin
(@sofy)
Support Team
Joined: 7 years ago

Hi @labradorman,

Please follow these steps:

  1. Install and activate the SyntaxHighlighter Evolved plugin
  2. Navigate to Dashboard > Forums > Settings > Features admin page, make sure the "Enable WordPress Shortcodes in Post Content" is disabled. 
  3.  Add the following CSS code in your current active theme functions.php file:
    function SyntaxHighlighter_fix_breaklines($content){
        return preg_replace('#<br[^<>]*?>#isu', "\r\n", $content);
    }
    
    function SyntaxHighlighter_for_wpforo(){
    	global $SyntaxHighlighter;
    	add_filter('wpforo_content_after', 'SyntaxHighlighter_fix_breaklines', 19);
    	add_filter('wpforo_content_after', array($SyntaxHighlighter, 'parse_shortcodes'), 20);
    }
    add_action('wp', 'SyntaxHighlighter_for_wpforo');
    
    

However, please note you need to use the source ( {:} ) button when you're adding a code. 

 

labradorman
Posts: 11
Topic starter
(@labradorman)
Active Member
Joined: 7 years ago

Dear Sofy,

Thank you so much for your kind and great help! It now works almost perfectly. Except with the same issue as mentioned in 

https://wpforo.com/community/how-to-and-troubleshooting-2/how-to-use-wpforo-with-syntaxhighlighter-evolved/

That is, the sign '&' and '>=' are now rendered incorrectly as '&amp;' and '&gt;'. Is there any way to deal with this wrong renders ? (I try to search for a simple solution, but couldn't find it)

labradorman
Posts: 11
Topic starter
(@labradorman)
Active Member
Joined: 7 years ago

I understand that the solution may require some of your efforts. Since this function is very important to my website, and wpforo is the best webboard on wordpress, if there is a service cost for this solution, I would be happy to pay for it. 

Sofy
Posts: 4802
 Sofy
Admin
(@sofy)
Support Team
Joined: 7 years ago

Hi labradorman,

Thank you for your interest in the wpForo.

The code I've provided just allows the SyntaxHighlighter Evolved plugin to work in wpForo post content. We've checked the code and it works fine on our test websites. 

For further support, we'll need admin accesses. Please send login details to info[at]gvectors.com email address. 

Page 1 / 3