WordPress – HTML In Comments

As shown in part 1 of this article, some themes display this as the html you are confined to when commenting:

<a href=”” title=””> <abbr title=””> <acronym title=””> <b> <blockquote cite=””> <cite> <code> <pre> <del datetime=””> <em> <i>
<q cite=””> <strike> <strong>

Explanation (for those not familiar with html)

All the above are opening tags: each one says “mark up the text from this point on”. Each one must always be paired with a corresponding closing tag (same tag but with a slash after the first bracket) that says “up to this point”.

<i>TEXT HERE</i>
<em>TEXT HERE</em>
Enclosed text will turn to italics.

<b>TEXT HERE</b>
<strong>TEXT HERE</strong>
Enclosed text will turn bold.

(Strictly speaking, “em” and “strong” mean emphasis and stronger emphasis, and can result in some other differentiation; in practice they almost invariably translate to italics and bold.)

<a href=””>TEXT HERE</a>
Enclosed text will turn into a link to the address you put inside the quotes.
(The address must be the exact complete URL as copied from the address bar of your browser.)

<blockquote>TEXT HERE</blockquote>
<cite>TEXT HERE</cite>
<q>TEXT HERE</q>
Enclosed text is a quotation. The visual result varies, depending on the theme. Forget “q”, as it doesn’t work in Explorer.

<del>TEXT HERE</del>
<strike>TEXT HERE</strike>
Enclosed text will show up with a strikethrough line.

<pre>TEXT HERE</pre>
If you copy-paste some text from a text editor, enclosing it this way will preserve multiple spaces and line breaks.

<code>CODE HERE</code>
Displays computer code. Can’t be used to display html tags.

<abbr>WORD HERE</abbr>
<acronym>WORD HERE</acronym>
Enclosed word is an abbreviation or an acronym. No difference visually. Practically useless unless in conjunction with the title attribute.

Adding this to the opening tag of a link, an abbreviation or an acronym will make the text you put inside the quotes pop up upon hover over. For example, if you write this:
<a href=”http://blog.arvixe.com/2013/07/19/html-allowed-in-comments-1/” title=”Html allowed in comments (1)”>Click here for part 1 of this article</a>
the result will be this (place your cursor over the link and wait before clicking)
(And I would feel sorry for whomever uses this in a comment…)

Adding these to an opening “del” tag is meant for recording why and when the text was struck through, i.e revised. Absolutely pointless in a comment, plus no major browser supports them.

Additional remarks

• These tags can have a combined effect; for example:

<b><i>This will be bold and italics</i></b>

This will be regular text, <b>this will be bold, <i>this will be bold and italics, </i>this will be bold only, </b>this regular again.

• All other html tags and attributes are stripped out. So, among other things, you cannot make any other changes to the style or the formatting of the text (e.g. size, color, or indenting), you cannot make a link open in a new window, and you cannot insert images.

On the other hand:

• If you paste a valid URL, it will automatically turn into a live link.

• If you paste the URL of a Youtube video in particular, the video itself will show up.

(To disable a Youtube video posted that way in your blog: Comments > Edit > highlight video URL > click code button > click Update.)

• Some video shortcodes work. (I haven’t tried them all; of those I have tried, flickr, ted, wpvideo, and youtube work, blip.tv, livevideo, and vimeo don’t.)

• The soundcloud and gigya shortcodes also work.

Looking for quality WordPress Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , | Posted under WordPress | RSS 2.0

Author Spotlight

TJ Marsh

My name is Tj Marsh. I spend about 16 hours a day on the internet. Running my company and helping out here at Arvixe. I live in the good ole Arizona where it gets ridiculously hot. I love WordPress and a lot of other open source software along with coding.

Leave a Reply

Your email address will not be published. Required fields are marked *