| @@ -2,21 +2,23 @@ | ||
| 2 | 2 | /* |
| 3 | 3 | Plugin Name: Simple Code Embed |
| 4 | 4 | Plugin URI: http://www.artiss.co.uk/simple-code-embed |
| 5 | 5 | Description: Allows you to embed code into your posts & pages |
| 6 | -Version: 1.2 | |
| 6 | +Version: 1.0 | |
| 7 | 7 | Author: David Artiss |
| 8 | 8 | Author URI: http://www.artiss.co.uk |
| 9 | 9 | */ |
| 10 | 10 | add_filter('the_content', 'simple_code_embed'); |
| 11 | -function simple_code_embed($content) { | |
| 12 | - global $post; | |
| 13 | - $loop=1; | |
| 14 | - while ($loop<6) { | |
| 15 | - $code="CODE".$loop; | |
| 16 | - $html=get_post_meta($post->ID,$code,false); | |
| 17 | - $content=str_replace("%".$code."%",$html[0],$content); | |
| 18 | - $loop++; | |
| 19 | - } | |
| 20 | - return $content; | |
| 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; | |
| 21 | 23 | } |
| 22 | 24 | ?> |