Enable pre tag in comments of BeTheme

I'd like to support HTML pre-tags in comments. It works for my own comments, but they are removed on save for comments of others.

How can I enable support for pre-tags in comments of the Be Theme

Comments

  • Hi,

    Please always attach a link to your website so we can check it out. If the page is offline(localhost), then our help will be limited. You will have to contact us when the page is online. Also, please make sure that the page is not under maintenance before you provide us with the link.

    It is always a good idea to also attach a screenshot showing what you refer to.

    Thanks

  • It's quite a generic question. So the link to the site does not help.

    The editor used in comments allows to use <pre> and </pre> tags. However, they are lost on save when the comment is from another person than me.


    Wordpress allows configuring the accepted HTML tags. This blog post mentions the following code for that purpose:

    // Create function which allows more tags within comments
    function allow_pres() {
    	global $allowedtags;
    	$allowedtags['pre'] = array('class'=>array());
    }
    
    // Add WordPress hook to use the function
    add_action('comment_post', 'allow_pres');
    

    Is there a way to achieve that in Betheme? Maybe in a future version? Is there a way to add the above filter in a way without changing the theme code and therefore losing it with every Betheme version update?

    Any hint is welcome.

    Thanks a lot.

  • Please use Plain text/HTML or Code elements.

    Best regards

  • edited April 2023

    Hmmm... and where do I find these options?

    I've found https://support.muffingroup.com/faq/custom-html-does-not-save/ which explains why it does not work by default. However, I'm looking for a way to overcome this limitation partially. Adding the pre-tag would be enough.

  • I'm sorry, it looks like this is not a BeTheme issue. For completeness, I show what I've tried.

    1) I added a comment on a blog post with a pre-tag

    2) Then I pressed the "Post Comment" button. The pre-tag was preserved.

    3) Then I opened the editor as admin here

    4) And pressed the "Update Comment" button without a change. This removed the open and closing pre-tags. Here's the screenshot after reopening the editor:

    It looks like this behaviour is caused by $allowedtags defined in kses.php. Adding 'pre' to the array "solves" the issue. However, it's for sure not the right place to do that there.

  • 1) What I showed in my previous message are elements available in BeBuilder.

    2) Comments come from WordPress, and we do change their functionality. Moreover, the file you mentioned is a WordPress file which we do not have influence over either.

    If you want to modify this file, I suggest consulting with your web developer.


    Best reager

Sign In or Register to comment.