WordPress Posting and Commenting Tips
WordPress is smart — really smart — and I like that, but it requires the right input if you want to exercise its abilities. What follows are a few things I do to get the most out of WordPress’s highly professional desktop-like web publishing features. Many of the tips I will offer carry over to the commenting side as well, not just article posting. Please know that I am not using the Visual Rich Editor so while most of the posting tips will apply, they may not be all shared.
Forming Paragraphs
This feature applies to more than just WordPress. I dare say most publishing platforms — blogs, wikis, forums — offer this functionality. Function being the operative part; specifically the PHP Hypertext Preprocessor (PHP) function that goes by the name autop()
. As the name implies, it automatically creates the <p></p>
or paragraph element.
To use it, on your keyboard just hit Enter twice to create two new lines in the text area. The second line will begin the new paragraph. Hitting Enter once will create a break element. This should be avoided because it can look sloppy, especially if the text is enlarged.
Example of creating paragraphs
<!--Enter text this way…--> Line ONE entered in the textarea in relation to line TWO. Line TWO entered in the textarea in relation to line ONE. <!--And it will output this automatically…--><p>
Line ONE entered in the textarea in relation to line TWO.<br />
Line TWO entered in the textarea in relation to line ONE.</p>
<!--But enter text this way…--> Line ONE entered in the textarea in relation to line TWO. Line TWO entered in the textarea in relation to line ONE. <!--And it will output this automatically…--><p>
Line ONE entered in the textarea in relation to line TWO.</p>
<p>
Line TWO entered in the textarea in relation to line ONE.</p>
This feature is available during posting and commenting.
Other Cool Conversions
I’ve always thought of this type of script as a SmartyPants-type script. SmartyPants is a project by John Gruber. It is an outstanding script that performs all sorts of intelligent feats of conversion. WordPress is equipped with a comparable script.
It does a lot on behalf of the author. Certain simple plain text characters — plain text as opposed to text produced by Word — can be converted into fancy typographer counterparts in a way that is stable on all systems. (Stable is not the case when pasting already-converted characters into the text area.) Character conversions include the following and apply to both posting and commenting…
Quotes
Plain text quotes, the straight up-and-down variety — "
plain quoted text"
— will be converted into this: “
fancy quoted text”
(produces “
quoted text”
).
Apostrophes
A plain text apostrophe, the straight up-and-down variety — Mike'
s — will be converted into this: Mike’
s (produces Mike’
s).
A leading apostrophe, however — you know, like '
Tis plain text — will produce this: ‘
Tis fancy text, but not reliably or so I’ve experienced. Instead of producing ‘
Tis fancy text you can sometimes get ’
Tis fancy text, which is incorrect. I sometimes have to enter it manually. (See update comment.)
Ampersands
As above, ampersands are also converted — escaped, if you will. An ampersand should not be written as &
. It needs to be written as &
. You’ll encounter ampersands in text and headings, and also in web addresses. WordPress, and many of the publishing platforms I mentioned above, will automatically convert them, even in a web address, so you don’t have to. (WordPress converts it to &
, not &
, but either way is fine.)
N- and M-Dashes
You may have noticed m-dashes in the text above. It’s this —
and it’s written like this --
(produced as —
). According to the WordPress documentation you are supposed to enter two hyphens, --
to get an n-dash, –
(produced as –
), and three hyphens ---
to get an m-dash, —
(produced as —
). I have found that this is not the case when posting. Two or three hyphens produce an m-dash. An n-dash, if needed, must be entered manually: –
.
Important: This does not carry over to posting comments. When commenting, if you want to produce a real m-dash, —
, you must enter three hyphens ---
.
Writing Code or Mark-up
The good old code
tags, <code>code</code>
, which are also available for use when commenting, sort of undo all of that above. Anything within code tags won’t be converted, it’ll leave your quotes, apostrophes, n- and m-dashes alone, As a result, additional steps may needed in some cases, since ampersands will still be converted, to write character codes as I have above, I have to convert the ampersands manually, like this: &#8212;
if I want to produce this: —
for all to see.
If you want to write a lot of code you may want to use the pre
element (pre
short for preserve, as in preserve white space). An example of this element, as I have it styled, can be viewed previously in this article. Bear in mind, though, the code or mark-up portion inside of the pre
element should also be used within the code
element to be precise. I haven’t done this prior to here and now, instead opting to use the pre
element alone, but it just occurred to me that I haven’t really been doing it right. As a result I can now properly add the code
element around code or mark-up and style it, pre code { }
, in my style sheets to make published code even more readable.
Important: If you want to write angle brackets, you must convert them, as follows: <
for the less than symbol <
and >
for the greater than symbol >
. If you don’t WordPress will try to render the contents as HyperText Mark-up Language (HTML).
The Power of the Optional Excerpt
This WordPress feature doesn’t apply to commenting, but for the author publishing an article or post, it’s a powerful ally. Normally formatting of links, emphasis elements, embedded image mark-up, and other mark-up will not be carried over to the front page of an excerpt-capable theme like this one if the <!--more-->
tag is used to mark the excerpt or if you let WordPress do it automatically, adding […]
For some reason all the good stuff is stripped away. Thus, if you want to offer images in your excerpts like I do, for instance, you must paste the content and mark-up into the post editor page’s “Optional Excerpts” textarea. This is a great feature as it gives you absolute control over what is in your excerpts. Since the excerpt itself will not have a permalink, I typically use the first paragraph of my post as the excerpt.
The Empowered Commenting Author
For people commenting on posts there are restrictions as to what mark-up can be posted, other than what’s noted above. For post authors, though, there are no restrictions. In other words, if the author wants to use the pre
element in a comment he or she can.
JackP responds:
Posted: July 30th, 2007 at 11:36 am →
I tell you what bugs me, is that there doesn’t seem to be a clever enough way to use code in post headings.
For example, my recent post has a title like this:
Psychic Kitten <span lang=’fr’>Qu’est-ce que c’est?</span>
Theoretically, that’s what I need to do. I’m changing the language, I need to mark it up. The problem however is that while wordpress is mostly okay with this — it displays fine, assuming I use single quotes for attribute values — the whole span thing shows up as a title/tooltip.
What I’d like is for it to be clever enough to accept my heading as is, but to strip out any HTML tags from it before using it elsewhere - e.g. in headings and the like.
Mike Cherim responds:
Posted: July 30th, 2007 at 3:37 pm →
Right you are Jack. I just got done trying a few things, experiments, to possibly correct that on the theme level and I couldn’t seem to get it to strip the tags. What I could offer as a suggestion is to do into the index.php, archive.php, and search.php file and physically remove the title attribute from the link headings. Or at least remove the part of it called for the title:
Change to this:
Also do that on the single.php file. It’s not a link but you’ll get the same issue.
JackP responds:
Posted: July 30th, 2007 at 6:45 pm →
I might try and have a play with that. Maybe if I can identify whether the title contains “<span” then use “reading the rest of this post”; otherwise use as normal…
Mike Cherim responds:
Posted: July 30th, 2007 at 7:02 pm →
I tried resolving that within the theme’s loop, applying
strip_tags()
, like this:<?php strip_tags(the_title()); ?>
, but it didn’t work so I don’t know if you’ll have any luck going that route. It might need to be addressed in the WP core files (maybe one of the template function files perhaps). If you find something, though, please let me know.Tommy Olsson responds:
Posted: July 31st, 2007 at 1:27 am →
English is not my first language, but is your text about apostrophes really accurate, Mike?
If you want to write ’Tis fancy text, surely U+2019 (8217 decimal) is the correct character, since you want a regular apostrophe – just as in Mike’s. The apostrophe in ’Tis signifies the elision of the initial ‘i’ in ‘it is’, doesn’t it?
The only time you’d need U+2018 (8216 decimal) is when using British-style single quoting ‘like this’ instead of American-style double quoting “like this”. At least that’s what I thought, but I’m a foreigner so what do I know?
Mike Cherim responds:
Posted: July 31st, 2007 at 9:24 am →
One thing I have learned about adults who learn a second language in their life: they tend to know the technical side of a given language better than the natives at times. That’s the case here. Finding specifics was difficult, and “The Elements of Style” by Strunk and White (4th edition 0-205-30902-X) unfortunately didn’t give me the answer. It may be there, but I couldn’t find it. But I think you’re right, Tommy. And if this is true, Wordpress and others may be at fault by overdoing it.
I found this passage at Wikipedia:
Note: WordPress got it wrong and added
‘
to the “correct” 04 above.Thanks Tommy.
John Faulds responds:
Posted: August 1st, 2007 at 1:58 am →
I think you only need to do it for the less than symbol because if it doesn’t recognise the opening of the tag as HTML, it doesn’t matter if the last part is.
Mike Cherim responds:
Posted: August 1st, 2007 at 2:09 pm →
Good to know, John. I suspect it’s probably wise to encode both on any web site but thanks for the heads up. I guess I’m not surprised by the way WP processes content.
On another note, (I’m such a bone head): I forgot one common conversion. Namely ellipses… they are written by string together three consecutive periods (dots) without spaces.
...
gets converted to…
(produces…
). The advantage to this conversion is that it takes three characters and turn them into one. This way they cannot be broken on a line break, etc.milo responds:
Posted: August 1st, 2007 at 2:55 pm →
Check this link, Mike, seems like they are using a function php to secretly place advertising on blogs that are using one of their themes, including some of yours.
Mike Cherim responds:
Posted: August 1st, 2007 at 3:47 pm →
Thanks for the heads up Milo. I wish that site offered a way to contact them so I could ask them to remove my theme. They are indeed adding a link to their site from the footer of the themes they are offering. I don’t see what gives them the right to do that since they aren’t even authorized to offer my theme. If I cannot contact them I cannot stop them, but I would encourage people to not download from there and to instead download from my site. For one reason, even if the added link isn’t reason enough, they are at least five builds behind the current version.
Thus, in summary, they’re offering a discreetly modified version of my theme for personal gain, without permission, getting a link back for doing so, and not serving users well by not offering the most current version. Not a very cool thing to do
Again, Milo, thanks for the heads up. I just wish I knew what to do about it. Any suggestions?
milo responds:
Posted: August 3rd, 2007 at 4:06 am →
Derek wrote a warning post, I’ve done it at the WP forum, might be helpful for some users if you list this templatebrowser issue too? Informed weblog tool collection, Lorelle and a bunch of other designers, we’ll see if we can stop this.
Mike Cherim responds:
Posted: August 3rd, 2007 at 8:58 am →
Yikes, it’s worse than I thought. I thought they were just squeezing in their link. Thanks Milo.