WordPress HELP!!

Public Group active 1 year ago

Embedding code into posts

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #38591

    I’ve activated the WP-Code-Highlight plugin on my site and want to be able to include code into my entry. However, WP seems to be stripping out certain parts of it. (I’m in the text editor, not the visual editor.) In particular, it seems to dislike the input element as well as the script element.

    This works on other, non-Commons WP blogs without a problem:

    http://blog.verbovetskaya.com/2013/10/18/user-triggered-error-reporting-in-ezproxy/

    However, the code is being stripped from the entry on my Commons site:

    http://ols57.commons.gc.cuny.edu/2015/03/19/how-to-user-triggered-error-reporting-in-ezproxy/

    Any help would be appreciated!

    #38593

    Maybe minify the code before pasting?
    Also,certain that you pasted into text view?

    #38596

    Hi –
    I tried with that plugin and got the same results – it does seem to strip out certain tags. Can you try the “Syntax Highlighter Evolved” plugin. That worked for me using your same code snippet. I wrapped snippet in [splus]…[/splus] tags. Make sure that you stay in text editor. Hope this helps.

    #38607

    Thanks for the replies!

    Stephen, yes, I’m definitely in the text editor. (I’ve turned off the visual editor altogether.) And it’s a how-to post so I want the code to be clear. Minifying it would muddle it for people unfamiliar with HTML/JavaScript.

    Scott, I tried the SyntaxHighlighter Evolved plugin but it seems to encode all the brackets. See the attached.

    Even without a plugin, wrapping code in <pre> tags should make it display as-is but that’s also failing.

    Attachments:
    You must be logged in to view attached files.
    #38620

    Hi Allie – that is odd. On my site, your code snippet renders fine using the SyntaxHighlighter Evolved plugin. Could you try testing on a brand new page. Perhaps you have some encoding tags that are throwing off the display?

    #38621

    I wrote a new entry (kept it in draft mode, though) and pasted the code… with the same results. Tried reactivating the WP-Code-Highlight plugin and checked the post. No change :-/

    #38626

    Hi Allie – I created a new site, using your theme to see if I could replicate your issue. I also invited you as an admin to the site. I created the page here to test the sytax highlighter evolved, using your code snippet: http://chunktest.commons.gc.cuny.edu/6-2/

    It seems to work fine. Can you check out the code tags and see if they match yours?

    #38636

    Since I was writing a post, I made two posts to see how the two plugins work:

    http://chunktest.commons.gc.cuny.edu/2015/03/22/code-with-wp-code-highlight/

    http://chunktest.commons.gc.cuny.edu/2015/03/22/code-with-syntaxhighlighter-evolved/

    WP-Code-Highlighter fails while SyntaxHighLighter Evolved does display the code. Hmm…

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.