WordPress.org

Ready to get started?Download WordPress

Forums

bbPress Topics for Posts
[resolved] Mathjax equations in the post (5 posts)

  1. sangil
    Member
    Posted 2 years ago #

    I am using "simple mathjax" plugin to display equations in LaTeX code in the post, for instance,
    \[ \sin x \]
    shows sin x.

    But backslashes in the post disappear when it is copied to the forum.
    Then the math equations are not displayed correctly.

    How can I fix this?

    http://wordpress.org/extend/plugins/bbpress-post-topics/

  2. David Dean
    Member
    Plugin Author

    Posted 2 years ago #

    Hey sangil,

    I see what you mean! I traced this out and it looks like the backslashes are in place until this plugin hands off the content to bbPress. They are ultimately taken off when the new topic is made, when WP runs stripslashes on the content.

    I can addslashes before sending the content along, but I want to do some testing and make sure that doesn't cause any issues. In the meantime, you can put a snippet like the following in your theme's functions.php file to accomplish the same thing:

    add_filter( 'bbppt_topic_content', 'addslashes' );

    Let me know how this works for you!

  3. sangil
    Member
    Posted 2 years ago #

    Hello?

    Unfortunately, after adding "add_filter" to the functions.php into the child theme,
    the contents are not copied at all.
    Any suggestions?

    .../wp-content/themes/twentyeleven-child$ more functions.php
    <?php
    add_filter( 'bbppt_topic_content', 'addslashes' );
    ?>

  4. sangil
    Member
    Posted 2 years ago #

    Oops... Please ignore my previous reply.
    Your suggestion works! (I forgot the fact that during experiment I removed the format string in the admin menu..)

    I made a child theme with the above functions.php
    and now it works.

  5. David Dean
    Member
    Plugin Author

    Posted 2 years ago #

    Whew! You had me going there for a minute. :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic