• Resolved psorensen

    (@psorensen)


    Thank you for the great plugin. It’s been quite the life-saver with converting a 50,000+ page static site to WP.

    I am having a similar problem as the one described before, but since the topic was resolved in e-mail and not publicly, I’ll address it again.

    I have a set of pages that include each include a link, which I would like to import as a custom field. I am able to identify a unique selector for the link’s container, but after import, the custom field is blank. Likely because it strips the html of custom fields.

    The html for the link:
    <b class="link-container"><a href="link-to-resource">Link To Resource</a></b>

    So, when I set a custom field “resource-link” to select the <b> element with a class of “link-container” in the example, the custom field, “resource-link”, exists, but it empty.

    Is there any development on making the stripping optional? Also, I’m not afraid to get my hands dirty with the php, so if there’s a temporary fix I can apply, I’d be very grateful. Actually, The ideal solution would be to save the href of the link as the custom field.

    Thanks again for all the hard work!

    http://wordpress.org/plugins/import-html-pages/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter psorensen

    (@psorensen)

    Figured out a solution for anyone else looking for this:

    on line 556 of html-importer.php change

    $customfields[$fieldname] = strip_tags($content[0]);

    to

    $customfields[$fieldname] = $content[0]->asXML();

    ‘->asXML’ retains html structure. I found this out by looking at the code in the same file for importing post content. Thanks, Stephanie for keeping your plugin well documented!

    Plugin Author Stephanie Leary

    (@sillybean)

    I’m glad you found that! I’ve sent a modified version of the plugin to someone else who needed custom fields with HTML, and I’m planning to include that option in a future version. I’ve been ill for several weeks, so it might take me a while to catch up on everything, but it’s coming!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom fields stripping html’ is closed to new replies.