I'm writing a plugin to import posts from a WordPress blog. The source post formats are inconsistent, some coming with full HTML (<p>
tags wrapping each paragraph, etc.), while others seem to just have tags added for formatting and emphasis—newlines but no paragraphs or <br>
's.
$entry->setContentFromPost(array(
'body' => $post['content'],
));
$success = craft()->entries->saveEntry($entry);
So without any adjustment, many of the imported posts look crappy on the front end when they're just dropped into a template with {{ entry.body }}
(Rich Text). The missing paragraph tags look less than stellar, and they're semantically uncool as well.
Redactor handles this just fine, so viewing and saving the imported entry in Craft is a breeze. It's not ideal, however, to go back and manually re-save each entry. Is there a way to re-save a cleaned Rich Text field via Craft's API, or do I need to standardize post HTML prior to my Craft import process?
craft()->entries->saveEntry()
work?craft()->entries->saveEntry()
. From your comments here, it's obvious that a) I've asked another crappy question and b) there's no magic Redactorize method I've failed to find and appreciate.