Posted By

zealmurapa on 04/19/11


html strip loop on

Versions (?)

Loop that strips unwanted html

 / Published in: PHP

strip html on loop

  1. <?php if (have_posts()) : while (have_posts()) : the_post();?>
  2. <?php ob_start();
  3. the_content(''.__('Read more <span class="meta-nav">&raquo;</span>', 'sandbox').'');
  4. $old_content = ob_get_clean();
  5. $new_content = strip_tags($old_content, '<hr><div><p><a><em><b><input><form><img><textarea><li><ol><ul><table><tr><td><th><i><b><h1><h2><h3><h4><h5><h6>');
  6. echo $new_content; ?>
  7. <?php endwhile; endif; ?>
  8. <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>

Report this snippet  


RSS Icon Subscribe to comments
Posted By: fris on April 20, 2011

remember to remove the closing codes too etc

You need to login to post a comment.