Make WordPress Core

Opened 14 years ago

Last modified 19 months ago

#18330 reopened enhancement

Add a Class functionality to wpautop()

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

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 14 years ago.

Download all attachments as: .zip

Change History (7)

@wpsmith
14 years ago

#1 @scribu
14 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

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
14 years ago

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

#3 @leec87
7 years ago

  • Resolution wontfix deleted
  • Status changed from closed to reopened

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
7 years ago

  • Resolution set to wontfix
  • Status changed from reopened to closed

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
2 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
19 months ago

  • Resolution wontfix deleted
  • Status changed from closed to reopened

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.