WordPress: Snippets

These are short notes for copy+paste.

Table of Contents


I use both English and Dutch for posts. Post that are read often will be translated. Otherwise, automatic translation is an option. So I create one page per language, start writing in one page while pasting the code below in the other page, renaming the URL. Do keep reading after the code snippets!

Translation from NL to EN:

<!– wp:paragraph –> <p>See: <a href=”URLNL”>URLNL</a> (or <a href=”http://translate.google.com/translate?js=n&amp;sl=nl&amp;tl=en&amp;u=URLNL”> automatic translation</a>).</p> <!– /wp:paragraph –>

Translation from EN to NL:

<!– wp:paragraph –> <p>Zie: <a href=”URLNL”>URLNL</a> (of <a href=”http://translate.google.com/translate?js=n&amp;sl=en&amp;tl=nl&amp;u=URLNL”> automatische vertaling</a>).</p> <!– /wp:paragraph –>

Now someway code tags don’t work for these snippets, WordPress seems to interpret the last /wp:paragraph as HTML, period! So, what I did is simply put encoded HTML statements between <p> </p>. Encoding HTML can be done online, for example here.

When you paste in code editor, the wp:paragraph tags get a bit corrupted, non critical and WordPress also starts adding extra double qoutes. But it is better to make an empty paragraph first and then paste what is in between these tags. Even better: paste from a text editor. All in all a bit sloppy!


Syntax highlighting using GeSHi… I must say it drives me a bit nuts, used to work with tags <!–wp:code><pre lang=”LANG” lines=”1″>The Code…</pre><!–/wp:code–>. Now a bit different in WP 5.2.1:

<!– wp:html –>
<pre lang=”lisp” line=”1″>
(strcat “Hello” “World”)
<!– /wp:html –>


  (strcat "Hello" "World")

Leave a Reply

Your email address will not be published.