WordPress.org

Ready to get started?Download WordPress

Forums

WordPress is adding a "<p>" before the page's content (9 posts)

  1. Stefancom
    Member
    Posted 8 years ago #

    I can't change it: though, this "" is not anywhere in my templates, WordPress simply adds it. Right before the content starts.

    But this spoils my CSS design.

    Where can I change this?

    Thanks!

    Stefan

  2. mjwood
    Member
    Posted 8 years ago #

    Link to your blog would be necessary for anyone to tell you what's going on.

  3. Stefancom
    Member
    Posted 8 years ago #

  4. trmtnbike
    Member
    Posted 8 years ago #

    Hello Stefancom,

    This is due to the wpautop filter that runs behind the scenes without most users knowing about it.

    You can either run the command

    remove_filter('the_content', 'wpautop');

    at some point before you call the_content(); in the loop, or you can replace

    <?php the_content(); ?>

    with:

    <?php echo $post->post_content; ?>

    You should be aware that using the second method bypasses all filters that any plugins run before displaying your content. I believe Markdown and other similar plugins are run at this time, so you may want to use the remove_filter option if you rely on this type of plugin.

  5. bt62190
    Member
    Posted 8 years ago #

    Is it possible to use CSS to style the p tag...

    p{
    margin:0px 0px 0px 0px;
    padding:0px 0px 0px 0px;
    }

    ...or something like that.

  6. Stefancom
    Member
    Posted 8 years ago #

    I see that problem with all these format stuff. Now, also "<br>" signs are gone...

    But well, maybe I can write them myself into the contentpages.

    No chance, just to take away "" and keep the rest?

    /Stefan

  7. bt62190
    Member
    Posted 8 years ago #

    ...

  8. bt62190
    Member
    Posted 8 years ago #

    In the settings you can change the main text entry box to be more simplified instead of the real time display deal. When you do this it seems that the p tags are not automatically added. Also I believe returns are added such as ('\\n' aka: chr(13)). The breaks can and prabably should be added later anyway, using a javascript or php function which will replace the return character with a br tag.

  9. iklanhot
    Member
    Posted 7 years ago #

    what if i want to remove all of <p> and </p> which is on the database to be not represented in the sites. Because it ruins the website presentation.

    in what file should I add str_replace() for this function ?

    thanks

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.