• Hello all.

    I want to add a custom class to every post text on the blog.
    Right now it’s just <p> content </p> but I want it to be <p class=”article”></p>

    I would go about doing this? Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Are you trying to add the article class to all paragraphs in the blog content or just certain paragraphs? If just certain paragraphs, then use the the syntax that you just provided. Make sure you are in the Text editor instead of the Visual editor or your HTML won’t save correctly.

    If you want to add the class to all paragraphs in the blog content, I’m not sure why you would do that. If you are trying to apply a rule to all paragraphs in a single post page, just write a rule like this:

    .single-post .entry-content p {
       font-size: 16px;
    }

    Thread Starter xKripz

    (@xkripz)

    Thank you, that CSS does the trick, but only when I’m on that single post. The posts that are on the homepage didn’t change. What is the selector for those?

    Thank you.

    Modify the rule so it looks like this:

    .home .entry-content p,
    .single-post .entry-content p {
       font-size: 16px;
    }

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Theme: Twenty Eleven] How to add class to posts’ is closed to new replies.