<p> tag the_content()

I’m trying to configure my content-page.php but i’m struggling with a few ‘mistakes’.

<article id="post-<?php the_ID(); ?>">
<div class="page_content">
<h1><?php the_title(); ?></h1>
**<p class="page_tekst">
<?php the_content(); ?>
</p>**
</div>
</article>

This is my css content

Read More
.page_content
{
    width:820px;
    height:auto;
    margin-bottom:50px;
}

.page_tekst
{
    text-align:justify;
    float:left;
}

This is the result in my browser

<article id="post-81">
<div class="page_content">
<h1>test</h1>
<p class="page_tekst">
<p>This is a test based on the current css code</p>
</p>
</article>

My css on the .page_tekst won’t work. I also understand why but is there a solution for it? Can you make a div or p tag, give it a call and put the content in this tag without making another P tag with the content?

Related posts

Leave a Reply

1 comment

  1. WordPress inserts p tags in the_content(), otherwise it would be rather difficult for your content to contain more than one paragraph. If you want to target the p WordPress inserts, just change your css to:

    .page_content p
    {
        text-align:justify;
        float:left;
    }
    

    and remove your wrapping <p> tag.