• I’m looking for a code snippet or plugin recommendation, I have a customer who creates pages in WordPress and adds a paypal button, using code generated from PayPal. She goes in to text view in the WordPress wysiwyg and pastes the code, the code is of format

    <form action='//paypal.com?kdjhfkjsdhf'>
    <input type='hidden' id=asdas'/>
    <input type='hidden' id=123'/>
    </form>

    So every new line is seen as a break and places lots of white space around the button. I had her remove all line breaks in the editor which removes all of the breaks, i.e.

    <form action='//paypal.com?kdjhfkjsdhf'><input type='hidden' id=asdas'/><input type='hidden' id=123'/></form>

    However often when she goes back to the Visual view to continue editing, WordPress will remove parts of the paypal code, breaking the button, so she has to go and do it again.

    I remember years ago when I had to insert php in to page content there was a plugin that let me use a shortcode to add the php, is there a html equivalent? Such as

    [no-format]
    <form action='//paypal.com?kdjhfkjsdhf'>
    <input type='hidden' id=asdas'/>
    <input type='hidden' id=123'/>
    </form>[/no-format]

    So that she can use the Visual editor as usual but prevent WordPress from doing its thing on the paypal button code?

    Thanks

Viewing 1 replies (of 1 total)
  • Would you consider doing a shortcode for this? That seems like it might be a good use for a shortcode to me. The hidden items could be set with attributes if they need to change page by page. You could do this by writing a simple plug-in or adding the shortcode to the functions.php file:

    https://codex.wordpress.org/Shortcode_API

    Sincerely,
    Scott

Viewing 1 replies (of 1 total)

The topic ‘Prevent formatting in code editor’ is closed to new replies.