Remove P tags when outputting content
-
Hi all,
When pulling in content for a post, is it possible to strip the paragraph tags that are added in via the tinyMCE plugin? The reason I would want to do it at code level is that I would like the paragraph tags to be added on some pages and not on others. Such as, when I add an image, I would like to remove the paragraph tags surrounding it.
So, here is an example of my line of code, can I add an extra condition here to remove the P tags?
<?php while (have_posts()) : the_post(); ?> <li> <a href="<?php the_permalink() ?>" rel="facebox"> <?php the_content(''); ?> </a> </li> <?php endwhile; ?>
So, for example where the content is pulled in, I wouldn’t want it to be wrapped in a <p> tag as it is already inside a HREF.
Oh, and I’ve checked the content in the database and the <p> tags are being added in there, so I want to strip them when they come back out if possible?
Would really appreciate any help.
- The topic ‘Remove P tags when outputting content’ is closed to new replies.