There could be a couple ways to do this. Unfortunately, I don’t think any will result in exactly what you’re going for. ( [paragraph last]
)
-
You could just create separate shortcodes for
[paragraph_first]
[paragraph_last]
[paragraph_foobar]
that handle $content without needing any attributes -
You could set the default value for last to
false
instead of''
, then require users to do[paragraph last=""]content[/paragraph]
-
You could add a more meaningful attribute such as
position
which could then be used like[paragraph position="first"]
or[paragraph position="last"]
Because of the fact that WordPress discards any atts not given defaults, and the fact that an att without an ="value"
is given the default value same as if it’s not listed at all, I don’t see any way to achieve [paragraph last]
Hopefully one of my 3 workaround will prove useful. Good luck!