Forums

Remove <P> </P> around <?php the_content(); ?> (18 posts)

  1. rknet
    Member
    Posted 6 years ago #

    Currently <?php the_content(); ?> is being wrapped by <P> </P>. Which file can I modify to just put in a <BR> instead? Thanks a lot!

  2. Jinsan
    Member
    Posted 6 years ago #

    index.php

  3. rknet
    Member
    Posted 6 years ago #

    I don't see it in there. I don't have a <P> or <BR> before the content... yet from viewing the source I can see it is putting in <P> </P>. Thanks.

  4. Lorelle
    Member
    Posted 6 years ago #

    By default, your content should be in paragraphs. If we had a link to your site we could see what you want to do and help you be more specific.

    Proper HTML formatting puts every paragraph in a <p> tag. This sets, by default, a break between the paragraphs. You can control the break between the paragraphs within the style.css under any reference to this tag.

    If you do not want "space" between the paragraphs, then you can change the style to something like this:

    #content p {margin: 0px 5px; padding: 0px 5px}

    This makes the paragraph have a 5 px margin on the left and the right, combined with a 5px padding "margin" on the left and right, adding up to 10pxs on either side to provide "space" between the edges of the container or page in which the content paragraph sits, BUT there should be no space between the tops and bottoms of the paragraph container.

    For more information on CSS and styling your WordPress Theme, check out the WordPress Codex, official documentation site:
    http://codex.wordpress.org

  5. Lorelle
    Member
    Posted 6 years ago #

    Also, the <p> is added by default automatically by WordPress. If we understood better how you want to use this, we could give you a better answer on how to change this.

    You will not "see" it until you have generated the page.

  6. rknet
    Member
    Posted 6 years ago #

    I have it set up at http://www.rilokiley.net/. There is an extra blank area inbetween the author/timestamp and content lines that I don't care for.

  7. schulte
    Member
    Posted 6 years ago #

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

  8. rknet
    Member
    Posted 6 years ago #

    Wow, that worked quite nicely. Thank you Schulte!!

  9. Lorelle
    Member
    Posted 6 years ago #

    If you are going to use the <br>, please use it right. In XHTML, it must have a self-closing tag and look like this: <br />

  10. rknet
    Member
    Posted 6 years ago #

    Where does it go? Does it hurt to not use it?

  11. Jinsan
    Member
    Posted 6 years ago #

    just put the slash in the code above before the end tag for the br and place a space between both as Lorelle as outlined

    it doesn't hurt not to use it - it's just valid xhtml markup. can we jut erase the marchitecture of "semantic"?

  12. rknet
    Member
    Posted 6 years ago #

    Thanks, using this now <?php echo $post->post_content; ?>

  13. rknet
    Member
    Posted 6 years ago #

    Er, I mean <?php echo $post->post_content; ?><br />

  14. rbarona
    Member
    Posted 6 years ago #

    The solution of "schulte" its so great! Thanks a lot!

  15. masquerade
    Member
    Posted 6 years ago #

    The nicer way would be to do remove_filters('the_content', 'wpautop'); before the loop.

  16. doodly
    Member
    Posted 6 years ago #

    masquerade, does this remove the autoformatting features in the post entry box (wrapping things in <p> </p> tags, for example?).

    If so, I'm looking for exactly that, but am not sure where to use the remove_filters('the_content', 'wpautop'); line.

  17. DreamFlasher
    Member
    Posted 6 years ago #

    remove_filter('the_content', 'wpautop');
    (filter without s) would be the right function. You can place it anywhere in your php code, but you should use it _before_ the output with the_content(); - if you want to have the effect ;)
    For filters also have a look here: http://codex.wordpress.org/Plugin_API#Removing_Actions_and_Filters

    //EDIT: I get no error when calling the function, but it doesn't seem as if it has any effect.
    //EDIT2: Solved with disabling the Markdown-Plugin which uses its own filters - but I don't know what I've disabled with disabling the Markdown-plugin *g*

  18. stevie7v
    Member
    Posted 5 years ago #

    Hi Guys - <newbie warning!>

    I understand the point of this thread but it doesn't quite do what I need. My blog - soon to be launched - is called blogolob. I've been trying out some dummy posts which include two or more quotations. It works fine on the home page but with 'Permalink' or 'Archives' the spacing in the quotes goes awry if I have more than one quote (look at the blue background). The problem seems to be caused by an extra set of <p> </p> in the offending pages but if I use one of the fixes above, I lose more lines than I want.

    Can anyone help?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags