1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Blogging' started by dheaven, Mar 20, 2009.

  1. dheaven

    dheaven Junior Member

    Joined:
    Jan 17, 2009
    Messages:
    110
    Likes Received:
    33
    Occupation:
    webdesigner
    Location:
    GMT +2
    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>
     
  2. del_boy

    del_boy Regular Member

    Joined:
    Dec 11, 2008
    Messages:
    222
    Likes Received:
    28
    Occupation:
    Wheeler Dealer
    Location:
    Down the Nag's Head
    Can you not use the text widget (if you're using wp that is) ?
     
  3. trapmuzik

    trapmuzik Junior Member

    Joined:
    Mar 20, 2009
    Messages:
    192
    Likes Received:
    22
    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
     
  4. dheaven

    dheaven Junior Member

    Joined:
    Jan 17, 2009
    Messages:
    110
    Likes Received:
    33
    Occupation:
    webdesigner
    Location:
    GMT +2
    not really

    i don't know how to rewrite/write a plugin :(
     
  5. saturday1

    saturday1 Power Member

    Joined:
    Dec 28, 2008
    Messages:
    564
    Likes Received:
    201
    That is feed summary --> [...]
     
  6. trapmuzik

    trapmuzik Junior Member

    Joined:
    Mar 20, 2009
    Messages:
    192
    Likes Received:
    22
    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
     
  7. saturday1

    saturday1 Power Member

    Joined:
    Dec 28, 2008
    Messages:
    564
    Likes Received:
    201
    I got more headache Seriously
     
  8. Hjalte81

    Hjalte81 Newbie

    Joined:
    Feb 20, 2009
    Messages:
    14
    Likes Received:
    1
    You can use a plugin called "post layout". It does exactly what you're looking for.
    Code:
    hXXp://wordpress.org/extend/plugins/post-layout/
     
  9. dheaven

    dheaven Junior Member

    Joined:
    Jan 17, 2009
    Messages:
    110
    Likes Received:
    33
    Occupation:
    webdesigner
    Location:
    GMT +2
    thank you guys :)
     
  10. matapples01

    matapples01 Regular Member

    Joined:
    May 15, 2008
    Messages:
    358
    Likes Received:
    208
    You can use php includes in the template files.