[REQ] Anyone knows a plugin who does this? [...]

dheaven

Junior Member
Joined
Jan 17, 2009
Messages
110
Reaction score
34
Hi, i am looking for a plugin that can insert automaticly "my custom codes" <nothing fancy> into all the posts in specific locations <start - end>
 
Can you not use the text widget (if you're using wp that is) ?
 
there are plenty of plugins that you can hack to do what you are asking. most of the plugins that do what you are asking use the the_content filter hook and look for a tag (i.e. <!--insertcodehere-->) and do a simple php str_replace
 
Can you not use the text widget (if you're using wp that is) ?

not really

there are plenty of plugins that you can hack to do what you are asking. most of the plugins that do what you are asking use the the_content filter hook and look for a tag (i.e. <!--insertcodehere-->) and do a simple php str_replace

i don't know how to rewrite/write a plugin :(
 
ok since im a nice guy i will give you a quick snippet that should work:

Code:
<?php 
/*
    Plugin Name: My Custom Content
    Plugin URI: http:**whatever.com
    Description: blah
    Version: 1.0
    Author: Me
    
*/
    

function myfunction_insert( $content ) {
        if(preg_match('#<!--mycustomcontent-->#', $content)) {
                $newcontent = str_replace('<!--mycustomcontent-->', 'my custom code right here', $content);
        }
        return $newcontent;
}

add_filter('the_content', 'myfunction_insert');

?>
now stick <!--mycustomcontent--> into any post and it will be replaced with the custom content
 
You can use a plugin called "post layout". It does exactly what you're looking for.
Code:
hXXp://wordpress.org/extend/plugins/post-layout/
 
Back
Top