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

[Ask]WP plugin to modify post text in bulk

Discussion in 'Blogging' started by adward, May 8, 2010.

  1. adward

    adward Power Member

    Joined:
    Nov 22, 2007
    Messages:
    722
    Likes Received:
    221
    Hello blogger,
    Do you know any wp plugin to modify post text automatically in bulk.
    I have a blog with many posts and it's impossible to modify all individual one. If there is a plugin to modify the text based on pattern, it would be great.
    Thanks for your input!
     
  2. netfish

    netfish Junior Member

    Joined:
    Mar 5, 2010
    Messages:
    106
    Likes Received:
    33
    Occupation:
    Software Engineering: Javascript, CSS, HTML5, PHP,
    Location:
    Baltimore, MD
    Try
    Code:
    http://wprewriter.com
    and see if it's of any assistance to you. I'm not sure if it does bulk rewriting or not.
     
    • Thanks Thanks x 1
  3. XoC--

    XoC-- Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 5, 2009
    Messages:
    211
    Likes Received:
    113
    What exactly are you trying to do?

    If you want to change text on the fly rather than editing the database you can create a plugin like this:

    Code:
    add_filter('the_content', 'rewrite_text', 1);
    
    function rewrite_text($article) {
      /* Do something with $article */
      return $article;
    }
    
     
    • Thanks Thanks x 2
  4. adward

    adward Power Member

    Joined:
    Nov 22, 2007
    Messages:
    722
    Likes Received:
    221
    Thanks for your input!

    I installed Ad Manager and wanna add the adsense inside the post.
    For example, the text: "well come here" will be replaced by "well come here [ad#1]"

    to XoC: I never try your method. Could you explain more details?
     
  5. XoC--

    XoC-- Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 5, 2009
    Messages:
    211
    Likes Received:
    113
    Hmm, I see well you could try doing this.

    1) Create a folder inside wp-content/plugins/mynewplugin
    2) Write to a new file we'll call it index.php
    3) Add this:

    Code:
    <?php
    /*
    Plugin Name: My Ad Script
    Plugin URI: http://www.blackhatworld.com
    Author: ME
    Description: Replaced keywords with ad code
    */
    
    function rewrite_text($article) {
       $adcode = "the ad code";
       $article = preg_replace("/(well come here)/", "$1 $adcode", $article);
       return $article;
    }
    
    add_filter('the_content', 'rewrite_text', 1);
    
    ?>
    
    You will need to activate the plugin in wordpress before it works, let me know how it goes for you.
     
    • Thanks Thanks x 1
  6. netfish

    netfish Junior Member

    Joined:
    Mar 5, 2010
    Messages:
    106
    Likes Received:
    33
    Occupation:
    Software Engineering: Javascript, CSS, HTML5, PHP,
    Location:
    Baltimore, MD
    Looks very nice, I can even use this myself for a more customized script.
     
    • Thanks Thanks x 1
  7. Tighearna

    Tighearna Registered Member

    Joined:
    Apr 21, 2010
    Messages:
    53
    Likes Received:
    19
    Occupation:
    Bokor
    Location:
    739 Bourbon St, New Orleans, LA 70116
    I've been using wpunique, seems to be working very well. Everything on my sites pass copyscape. It has a function to to do exactly what you are talking about just set it so (phrase x) = ((prase x) + [ad#1]). I hope that makes sense.
     
    • Thanks Thanks x 1
  8. adward

    adward Power Member

    Joined:
    Nov 22, 2007
    Messages:
    722
    Likes Received:
    221
    Thanks for all helpful info. :)