Make WordPress Core

Opened 15 years ago

Last modified 3 years ago

#18330 reopened enhancement

Add a Class functionality to wpautop()

Reported by: wpsmith Owned by:
Priority: normal Milestone:
Component: Formatting Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

It would be nice to be able to add a class to <p> with wpauto as an optional arg.

Attachments (1)

wpautop.patch (2.3 KB ) - added by wpsmith 15 years ago.

Download all attachments as: .zip

Change History (7)

@wpsmith
15 years ago

#1 @scribu
15 years ago

  • Milestone Awaiting Review
  • Resolutionwontfix
  • Status newclosed

Erm... no.

Instead of each paragraph having a class, wrap that particular group of paragraphs in a container and add a class to the container.

Then you can style the paragraphs just as easily.

#2 @wpsmith
15 years ago

Yea, that's what I thought as I though through it a bit more.

#3 @leec87
9 years ago

  • Resolution wontfix
  • Status closedreopened

I respectfully disagree with @scribu, and think this is a valid argument to make.

If the user wanted to go along the Bootstrap route, and apply the lead class to paragraphs, it would need to be added directly to each p element, not a container that encases them.

I believe many people will want this patch to be added, including myself.

Please consider re-evaluating this?

https://getbootstrap.com/docs/3.3/css/#lead-body-copy

#4 @dd32
9 years ago

  • Resolutionwontfix
  • Status reopenedclosed

With no other requests in 6 years, I don't think this is a beneficial change to such a low-level function that's designed to be called as a filter on the_content & friends.

Adding the class to a wrapping element is how you'd do it with standard CSS/HTML, I don't think Bootstrap is enough of a use-case to add it here.
While I can see the usage within some themes, if you're wanting to do things like this it seems likely that you'd be better off rolling an extra output filter on the text you're altering (such as only applying the change to the first <p> or similar element) or running the specific text you're changing through the various functions you want directly.

I'm re-closing this as wontfix pending more requests for the functionality.

#5 follow-up: @retlehs
4 years ago

It might be worth revisiting this request considering the current trend of using utility-based CSS frameworks, such as Tailwind CSS, and the need to apply specific classes to each paragraph element generated by the wpautop function

#6 in reply to: ↑ 5 @10fdesign
3 years ago

  • Resolution wontfix
  • Status closedreopened

Replying to retlehs:

It might be worth revisiting this request considering the current trend of using utility-based CSS frameworks, such as Tailwind CSS, and the need to apply specific classes to each paragraph element generated by the wpautop function

Agreed! This would be very useful. Right now it's a gap in our Tailwind workflow.

Note: See TracTickets for help on using tickets.