This post is here mostly as I expect to forget this tidbit. Human memory freshness dwindles exponentially.
Over in my work at the OpenETC I wrote a guide for using the Display Posts plugin.
This most handy plugin lets you take control of where and how to display dynamically a list of posts, rather than just what WordPress or a theme gives you (within category! With/Without excerpt! in reverse order! random posts! random! Custom posts types with a specific taxonomy authored by one person).
These are rendered dynamically where a placeholder is put in the post, aka a WordPress shortcode. These things in brackets
[[some_shortcode_that_does_something]] are how one inserts H5P content in, a WordPress Gallery, and much more.
I went a little bonkers in that post, which led to some cussing at the Block Editor, on how to do exactly what I did above- how to I show a shortcode without it doing it’s thing?
I tried using the HTML substitutes for the
] characters, or
&amp;rbrack;. It works in preview, but when published, WordPress decides to make them brackets, and then.. shortcode replacement occurs.
The same happened for using
pre tags in a Custom HTML block and also the Code block.
It was taking me longer to show how to display a shortcode than to write about it. The answer was a Homer SImpson head-slapping DOH found in StackExchange (where most answers live to be google).
You see, if I enter something between brackets that WordPress does not have a matching shortcode for, it just shows as text:
So that means if I put a shortcode inside shortcode brackets, it does not match! Hence, I was able to provide an example of a shortcode in my post:
[[display-posts posts_per_page="5" orderby="rand"]]
Pretty trivial, but now I have a bit of data here in my Outboard Brain.
Featured Image: This is how I felt on finding the obvious solution I should have known!