How do I post shortcode as code?
-
I just tried to write a blog post about the wonderful display-posts shortcode. But ironically, I found myself unable to display the code! It kept evaluating instead, even when I used the [code]...[/code] markup as recommended by http://en.support.wordpress.com/code/posting-source-code/.
I’m assuming this is because I am failing to specify language=”xxx” correctly. But I don’t know what language it is. Help?
The blog I need help with is: (visible only to logged in users)
-
Exactly, which display shortcode did you use please?
http://en.support.wordpress.com/display-posts-shortcode/Post it here between code tags.
-
I see this one on the blog
(note the space following the d)[d isplay-posts tag=”favourites” orderby=”rand” posts_per_page=”4″ wrapper=”div” image_size=”thumbnail” ]
-
That’s the one.
[display-posts tag="favourites" orderby="rand" posts_per_page="4" wrapper="div" image_size="thumbnail" ] -
I had to include the space following the “d” because it wouldn’t display otherwise. I assume that’s because it was trying to evaluate instead.
-
The code I posted above is a direct copy paste from your post and it has an issue because there is a space following the initial “d”
-
You’re misunderstanding my question. And are you sure you want to respond to this thread? Last time we talked you were alarmed once you realised who I was. The WP.com staff made it clear that I’m not in violation of the terms of service, but I think you didn’t want to be associated with BDSM bloggers in any way.
-
Apologies, instead of stating that there was a misunderstanding, I should have clarified. Here is the clarification.
I want people to see the shortcode so they can use it. This is what I want to display:
[display-posts tag="favourites" orderby="rand" posts_per_page="4" wrapper="div" image_size="thumbnail" ]But instead I kept getting an empty line. I assume this is because the post is trying to evaluate the shortcode, even though I am using [code] tags. I don't understand why the [code] tags work here in the forum but not on my site.
My temporary solution was to insert a space that invalidates the shortcode, which timethief thinks is a typo. It's not, and I told my readers to take it out when they actually try to use the code themselves. But obviously this is not an elegant solution.
- The topic ‘How do I post shortcode as code?’ is closed to new replies.