Code Embed - Version 1.0

Version Description

Download this release

Release Info

Developer dartiss
Plugin Icon 128x128 Code Embed
Version 1.0
Comparing to
See all releases

Version 1.0

Files changed (2) hide show
  1. readme.txt +41 -0
  2. simple-code-embed.php +24 -0
readme.txt ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Simple Code Embed ===
2
+ Contributors: dartiss
3
+ Donate link: http://tinyurl.com/bdc4uu
4
+ Tags: Code, HTML, JavaScript, XHTML, Embed, YouTube
5
+ Requires at least: 2.0.0
6
+ Tested up to: 2.7.1
7
+ Stable tag: 1.0
8
+
9
+ Embed code, whether HTML or JavaScript, directly in your posts and pages. Ideal for showing YouTube videos!
10
+
11
+ == Description ==
12
+
13
+ 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.
14
+
15
+ This plugin makes use of the Custom Fields facility when creating/editing posts and pages.
16
+
17
+ Add a custom field named `%CODEx%`, where x is a number between 1 and 5 (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.
18
+
19
+ Now, in your post or page simply add a reference to `%CODEx%` (again where x is the number that you used before).
20
+
21
+ Here's an example. I create a custom field named `%CODE1%` with a value of...
22
+
23
+ `<object width="425" height="344">`
24
+ `<param name="movie" value="http://www.youtube.com/v/oHg5SJYRHA0&hl=en&fs=1"></param>`
25
+ `<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>`
26
+ `<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>`
27
+ `</object>`
28
+
29
+ Then, where I wish the video to appear in my post I simply add `%CODE1%`. Simple!
30
+
31
+ == Installation ==
32
+
33
+ 1. Upload the entire simple-code-embed folder to your wp-content/plugins/ directory.
34
+ 2. Activate the plugin through the ‘Plugins’ menu in WordPress.
35
+ 3. There is no options screen.
36
+
37
+ == Frequently Asked Questions ==
38
+
39
+ = How can I get help or request possible changes =
40
+
41
+ Feel free to report any problems, or suggestions for enhancements, to me either via my contact form or by the plugins homepage at http://www.artiss.co.uk/simple-code-embed
simple-code-embed.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Simple Code Embed
4
+ Plugin URI: http://www.artiss.co.uk/simple-code-embed
5
+ Description: Allows you to embed code into your posts & pages
6
+ Version: 1.0
7
+ Author: David Artiss
8
+ Author URI: http://www.artiss.co.uk
9
+ */
10
+ add_filter('the_content', 'simple_code_embed');
11
+
12
+ function simple_code_embed($content) {
13
+ global $post;
14
+ $page=$content;
15
+ $i=1;
16
+ while ($i<6) {
17
+ $code="CODE".$i;
18
+ $html=get_post_meta($post->ID,$code,false);
19
+ $page=str_replace("%".$code."%",$html[0],$page);
20
+ $i++;
21
+ }
22
+ return $page;
23
+ }
24
+ ?>