Simple Code Embed
Embed code, whether HTML or JavaScript, directly in your posts and pages. Ideal for showing YouTube videos!
Download
Download Simple Code Embed (v1.3, 11/03/2010)
Change Log
Version 1.0
- Initial release
Version 1.1
- The instructions have been corrected (thanks to John J. Camilleri for pointing it out!)
- Plugin has been tested with version 2.8 of WordPress.
- No code changes have been made
Version 1.2
- Simplification of code
Version 1.3
- Increased limit of number of code embeds from 5 to 20
Installation
- Upload the entire
simple-code-embedfolder to yourwp-content/plugins/directory. - Activate the plugin through the ‘Plugins’ menu in WordPress.
- There is no options screen.
Configuration
As you probably know if you put code directly into your post or page, it is often simply displayed as written rather than actually actioned. So, if you put the embed code of a YouTube video in a post it won’t display the video.
This plugin makes use of the Custom Fields facility when creating/editing posts and pages.
Add a custom field named CODEx, where x is a number between 1 and 20 (this allows you to have up to 5 pieces of embedded code per page or post). In the value field place your embedded code – this can be HTML, XHTML, JavaScript, etc. Server side languages, such as PHP, doesn’t work.
Now, in your post or page simply add a reference to %CODEx% (again where x is the number that you used before).
Here’s an example. I create a custom field named CODEx, where x is between 1 and 20, with a value of…
<object width="425" height="344"> <param name="movie" value="http://www.youtube.com/v/oHg5SJYRHA0&hl=en&fs=1"> </param> <param name="allowFullScreen" value="true"></param> <param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/oHg5SJYRHA0&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed> </object>
Then, where I wish the video to appear in my post I simply add %CODEx% (replacing x with the appropriate number between 1 and 20). Simple!
Problems/Queries
Please report any problems, or suggestions for enhancements, to me either via my contact form or by commenting on the appropriate entries on my blog.
Updates
Updates to this and any other of my WordPress plugins will be published on this blog.
Subscribe to my WordPress category feed.




















Artiss.co.uk is checked by
Don’t work for me, I use WP 2.7.1, and put %CODEx% in the visual editor and nothing, try using HTML editor and nothing…
Strange. I assume you’ve placed the code in a custom field which you’ve named CODE1? In which case, it should work. This recent blog entry of my own uses the plugin… http://www.artiss.co.uk/2009/05/you-had-it-wrong-all-along
Yes, I named it CODE1 with the “%” after and before, and nothing, then, when I see your reply without the %, I try again without them… but nothing, I see “CODE1″ in my entry, instead the iframe
I’ve got the same problem – the page is just blank.
Ok, the issue has now been fixed – the code was working fine, it was my instructions that were wrong. I’ve now correct them, both above and in the README file that accompanies the plugin.
In a nutshell, you should NOT put percentage signs around your custom field name – only when you specify it in your actual post should you do this.
Works like a dream. Fantastic!
Thank you,
Anita
Is there a way to allow this to work with embedding code in the sidebar?
Thanks in advance,
Sean
Any code can be embedded in the sidebar by adding it into the appropriate theme file – usually sidebar.php. Because a blog post or page is dynamically generated from databases, this is why they need a special plugin to add such a facility.
Thank you for this David. I was able to install the plug-in right from the built-in Wordpress MU Plug-in system and activate it system-wide. I’ve tested it and posted the instructions for our users.
This works on WP 2.91.
i´m using 2.91 and atahualpa. i´m trying to embed my blip tv player, but i get nothing… i´ve followed the instructions, so what do you think could be wrong?
regards
Send me the code and I’ll try it!
Your plugin is working great on several sites I’m working on. Now I have a page that needs EIGHT (8) code embeds … can the current limit of 5 be raised? (please?)
Of course. Meantime, if you open up simple-code-embed.php, you can change the limit on line 14. It currently states
<6– if you change this to<11, then this will give you a 10 per page limit.