Not signed in ( Sign In)

Categories

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorStanley
    • CommentTimeMay 19th 2010
     permalink
    Can someone point me in the right direction, e.g. how where to add a replace function (in xmlrpc.php, perhaps?) to allow me to strip out particular pieces of code from Posterous postings?

    Basically they add a div wrapper thus:

    <div class='posterous_autopost'> [my blog post] </div>

    But there also seem to be a few <p /> tags and the odd line break tag, for good measure (though these could be getting introduced by my e-mail client when I create the original post).

    The result is that the post starts right at the top of the entry page - on the same line as the FP edit/delete links, which can get overlaid with the text from the post (looks messy).

    If I can just find some way to add a line break to the top of any posting received via Posterous - just to drop it down a little, it would look a lot better. I might be able to exercise a bit more care when writing my original e-mail (or use a different mail client) to take care of any erroneous p & br tags.
    •  
      CommentAuthorNoWhereMan
    • CommentTimeMay 19th 2010
     permalink
    create a plugin, and paste in:

    add_filter('content_save_pre', 'plugin_strip_posterous_comment');

    function plugin_strip_posterous_comment($content) {

    // do stuff, for instance: (NOT TESTED!)
    // strip containing <div class='posterous_autopost'>POST CONTENTS</div> and spit out POST CONTENTS
    $processed_content = preg_replace("/<div class='posterous_autopost'>(.*)</div>/", '$1', $content);

    return $processed_content;

    }



    HTH
    •  
      CommentAuthorStanley
    • CommentTimeMay 19th 2010
     permalink
    Thanks! I'll experiment a bit more with it and see if I can come up with one which covers everything (they also add new divs when you include attachments so I need to try posting a variety of things to see what other code needs to be catered for).