WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Editing the default <p> tags in a post. (5 posts)

  1. dg77
    Member
    Posted 8 years ago #

    Currently, when someone makes a post, paragraphs are enclosed in plain html "p" tags.

    How can I edit these tags? I would like to assign a class to them. So, when a post is made paragraphs are enclosed in <p class="class_name">.

    Also: I don't want to have to do this manually each time, so using the 'HTML' button will not work.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 8 years ago #

    Any particular reason that you want to do this? The more normal approach to styling these things is to have all your posts enclosed in a content div, and then using something like #content p in your stylesheet to refer to the paragraphs.

  3. dg77
    Member
    Posted 8 years ago #

    I've added wordpress to the current design of our webite. It has it's own stylesheet, and the powers that be aren't going to modify it.

    p {margin:0px;}

    That is in our current style sheet. It's causing me a problem, because it removes the space inbetween paragraphs.

    I can change that with the blog's stylesheet, but it messes up our navigation menu when I do. So, I'd like to just give the tags in the blog their own class to differentiate the two in the stylesheet.

    If there's a better way, I'm definitly open to it.

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 8 years ago #

    I'd have to see the site to be specific about what to do, however there's almost always an easier way than editing the wordpress code itself. Wrap The Loop in a div id="content" and then add this to the blog's style sheet:
    #content p { margin: 10px; }
    ...or whatever. You can change those p's without changing *all* p's, and without using a class on the p's themselves.

  5. dg77
    Member
    Posted 8 years ago #

    Fantastic. That's exactly what I was looking for.

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.