How to keep html as html in wordpress?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am using codeMirror to add TryIt Editor as like w3school. The following is working fine:
<form>
<textarea id="code" name="code">
HTML CODE
</textarea>
</form>
But it is not working when I try to replace HTML CODE by the actual content as follows:
<form>
<textarea id="code" name="code">
<?php the_content(); ?>
</textarea>
</form>
I find out the actual reason behind this problem. When I save post in text mode(as following image) all html looks okay.
But when I change text mode to visual mode and back to text mode I can see the following:
I also try to wrap all the html with <pre> </pre>
but no luck. Any idea?
wordpress
add a comment |
I am using codeMirror to add TryIt Editor as like w3school. The following is working fine:
<form>
<textarea id="code" name="code">
HTML CODE
</textarea>
</form>
But it is not working when I try to replace HTML CODE by the actual content as follows:
<form>
<textarea id="code" name="code">
<?php the_content(); ?>
</textarea>
</form>
I find out the actual reason behind this problem. When I save post in text mode(as following image) all html looks okay.
But when I change text mode to visual mode and back to text mode I can see the following:
I also try to wrap all the html with <pre> </pre>
but no luck. Any idea?
wordpress
1
Known issue. You can't really prevent that from happening. Don't use the visual editor and you'll be fine.
– cabrerahector
Nov 24 '18 at 4:42
It's not appropriate to have the other content that the visual editor throws away in a textarea.
– Carol McKay
Nov 24 '18 at 7:14
add a comment |
I am using codeMirror to add TryIt Editor as like w3school. The following is working fine:
<form>
<textarea id="code" name="code">
HTML CODE
</textarea>
</form>
But it is not working when I try to replace HTML CODE by the actual content as follows:
<form>
<textarea id="code" name="code">
<?php the_content(); ?>
</textarea>
</form>
I find out the actual reason behind this problem. When I save post in text mode(as following image) all html looks okay.
But when I change text mode to visual mode and back to text mode I can see the following:
I also try to wrap all the html with <pre> </pre>
but no luck. Any idea?
wordpress
I am using codeMirror to add TryIt Editor as like w3school. The following is working fine:
<form>
<textarea id="code" name="code">
HTML CODE
</textarea>
</form>
But it is not working when I try to replace HTML CODE by the actual content as follows:
<form>
<textarea id="code" name="code">
<?php the_content(); ?>
</textarea>
</form>
I find out the actual reason behind this problem. When I save post in text mode(as following image) all html looks okay.
But when I change text mode to visual mode and back to text mode I can see the following:
I also try to wrap all the html with <pre> </pre>
but no luck. Any idea?
wordpress
wordpress
edited Nov 24 '18 at 7:03
stealththeninja
1,89911428
1,89911428
asked Nov 24 '18 at 3:53
Abdus Sattar BhuiyanAbdus Sattar Bhuiyan
1,60821540
1,60821540
1
Known issue. You can't really prevent that from happening. Don't use the visual editor and you'll be fine.
– cabrerahector
Nov 24 '18 at 4:42
It's not appropriate to have the other content that the visual editor throws away in a textarea.
– Carol McKay
Nov 24 '18 at 7:14
add a comment |
1
Known issue. You can't really prevent that from happening. Don't use the visual editor and you'll be fine.
– cabrerahector
Nov 24 '18 at 4:42
It's not appropriate to have the other content that the visual editor throws away in a textarea.
– Carol McKay
Nov 24 '18 at 7:14
1
1
Known issue. You can't really prevent that from happening. Don't use the visual editor and you'll be fine.
– cabrerahector
Nov 24 '18 at 4:42
Known issue. You can't really prevent that from happening. Don't use the visual editor and you'll be fine.
– cabrerahector
Nov 24 '18 at 4:42
It's not appropriate to have the other content that the visual editor throws away in a textarea.
– Carol McKay
Nov 24 '18 at 7:14
It's not appropriate to have the other content that the visual editor throws away in a textarea.
– Carol McKay
Nov 24 '18 at 7:14
add a comment |
1 Answer
1
active
oldest
votes
Note issue of tinyMCE on WP.
You can check using this plugin: https://wordpress.org/plugins/preserved-html-editor-markup/
But if you want a preatty clean solution you can use SHORTCODE to render your HTML structure inside the post safely.
SHORTCODE DOCS: https://codex.wordpress.org/Shortcode_API
or see this guide (in italian lang but you can translate it).
https://www.targetweb.it/come-creare-shortcode-wordpress-la-guida-completa/
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53455019%2fhow-to-keep-html-as-html-in-wordpress%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Note issue of tinyMCE on WP.
You can check using this plugin: https://wordpress.org/plugins/preserved-html-editor-markup/
But if you want a preatty clean solution you can use SHORTCODE to render your HTML structure inside the post safely.
SHORTCODE DOCS: https://codex.wordpress.org/Shortcode_API
or see this guide (in italian lang but you can translate it).
https://www.targetweb.it/come-creare-shortcode-wordpress-la-guida-completa/
add a comment |
Note issue of tinyMCE on WP.
You can check using this plugin: https://wordpress.org/plugins/preserved-html-editor-markup/
But if you want a preatty clean solution you can use SHORTCODE to render your HTML structure inside the post safely.
SHORTCODE DOCS: https://codex.wordpress.org/Shortcode_API
or see this guide (in italian lang but you can translate it).
https://www.targetweb.it/come-creare-shortcode-wordpress-la-guida-completa/
add a comment |
Note issue of tinyMCE on WP.
You can check using this plugin: https://wordpress.org/plugins/preserved-html-editor-markup/
But if you want a preatty clean solution you can use SHORTCODE to render your HTML structure inside the post safely.
SHORTCODE DOCS: https://codex.wordpress.org/Shortcode_API
or see this guide (in italian lang but you can translate it).
https://www.targetweb.it/come-creare-shortcode-wordpress-la-guida-completa/
Note issue of tinyMCE on WP.
You can check using this plugin: https://wordpress.org/plugins/preserved-html-editor-markup/
But if you want a preatty clean solution you can use SHORTCODE to render your HTML structure inside the post safely.
SHORTCODE DOCS: https://codex.wordpress.org/Shortcode_API
or see this guide (in italian lang but you can translate it).
https://www.targetweb.it/come-creare-shortcode-wordpress-la-guida-completa/
answered Nov 24 '18 at 8:15
Riccardo MelRiccardo Mel
317
317
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53455019%2fhow-to-keep-html-as-html-in-wordpress%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Known issue. You can't really prevent that from happening. Don't use the visual editor and you'll be fine.
– cabrerahector
Nov 24 '18 at 4:42
It's not appropriate to have the other content that the visual editor throws away in a textarea.
– Carol McKay
Nov 24 '18 at 7:14