Home Forums Trusted Removing html tags in page editor

Tagged: , ,

This topic contains 4 replies, has 2 voices, and was last updated by  paulmcf87 4 weeks, 1 day ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #5879

    paulmcf87
    Participant

    I have recently switched to the Trusted theme as I preferred the layout to the previous theme I was using.

    I am currently trying to add html scripting to one of my pages to add a “show more/less” button. I had difficulty with this in the previous theme but changed to TinyMCE Advanced editor and that sorted the issues.

    I am trying to add code of the sort:

    <div><input id=”post-1″ class=”read-more-state” type=”checkbox” />
    <div class=”read-more-wrap”>
    <h2>Header</h2>
    <p>Area shown before button</p>
    <div class=”read-more-target”>
    <p>Hidden Text revealed after button pressed</p>
    <p>More Text</p>
    <p>Even more text.</p>
    </div>
    </div>
    <label class=”read-more-trigger” for=”post-1″></label>

    </div>

    Once I save the the HTML, I end up with:

    <h2>Header</h2>
    <p>Area shown before button</p>
    <p>Hidden Text revealed after button pressed</p>
    <p>More Text</p>
    <p>Even more text.</p>

    All of the HTML elements bar <h2> and <p> have been removed which means the show more/less button is not displayed.

    As I said, I have added the TinyMCE Advanced editor, I have also added different code to functions.php to solve the issue similar to: what can be seen here.

    I can only assume now that there is something in the theme which is not allowing html tags to be added. any help would be great

    #5882

    Yazmin
    Keymaster

    In the page editor, if you switch from ‘Visual’ to ‘Text’ and then write or paste your content complete with HTML markup it should save with formatting intact.

    The issue occurs when switching back to ‘Visual’ editor, because in this mode WordPress will remove markup such as <div></div> and <input></input>. Markup such as headings <h2></h2> and paragraphs <p></p> are preserved.

    This is how WordPress works and is not affected by the theme, or at least it shouldn’t and any theme submitted to be listed at wordpress.org would not be allowed to do this, and none of our themes will ever remove HTML markup entered into the page/post editor.

    The way content is displayed on the front end is that WordPress renders the saved content and then the theme will add it’s own styling (color, font, font size/weight etc) to that content, but it will not remove any part of the saved content on the page.

    We cannot comment on how the TinyMCE Advanced editor plugin works or how it may or may not remove any HTML markup as it is not our plugin, and we would recommend checking out the documentation/support for that plugin.

    #5884

    paulmcf87
    Participant

    @yazmin thank you for your reply.

    I know switching from the text tab to visual can strip the HTML. I always ensure that I save the HTML whilst still on the Text tab.

    However, without switching tabs, the HTML still gets stripped. Everything is the same as my previous theme, the only difference is the Theme itself hence why I assuming there is something in the themes code causing the issue?

    • This reply was modified 1 month ago by  paulmcf87.
    #5886

    Yazmin
    Keymaster

    No, themes do not work on this level.

    I would say that as you have switched between themes and the issue is still occuring, that the conclusion should be that it is not the theme that is doing this.

    To show that it is not the theme causing this and that using the text view does not strip out HTML, check out the test page I have created on our Trusted theme demo site: https://uxlthemes.com/demo/trusted/test-page-paulmcf87/

    Using your HTML code, I added it to the page using the text view of the page editor, and all the HTML is still there on the saved page when viewed.

    #5898

    paulmcf87
    Participant

    @ Yazmin

    sorry, I have figured it out. my error 🙁

     

    feel free to remove this question lol

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

You must be logged in to reply to this topic.