Forums

[resolved] How to prevent p tags from being generated (3 posts)

  1. bazzle83
    Member
    Posted 3 years ago #

    I'm using this mini-loop on my frontpage.

    <?php query_posts('cat=3&showposts="1'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <a href='<?php the_permalink() ?>'><?php the_content(); ?></a>
    <?php endwhile; ?>

    Basically it shows the first post from a category which is made up of image posts (no text)

    As you can see the_content is wrapped inside the_permalink. The problem here is that the_content automatically generates <p></p> tags around the content output.

    This is undesirable because having paragraph tags within links does not validate.

    Is there a way of modifying the_content tag so it excludes the <p> tags?

    Thanks

  2. whooami
    Member
    Posted 3 years ago #

    use get_the_content

  3. bazzle83
    Member
    Posted 3 years ago #

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic