kirbytextWrap - Remove or replace enclosing p tag and more



I made my first Kirby Plugin! Let me introduce you KirbytextWrap().

Remove OR replace the <p> </p> enclosing tag on kirbytext() and add somes HTML attributes.

  • Work for both K2 and K3 version.
  • CLI and Composer support.
  • Keep yours kirbytag working.

$page->title()->kirbytextWrap('h1') Will replace the <p> enclosing tag by <h1>.
$page->title()->kirbytextWrap('h1', ['class' => 'title']) Will replace the <p> enclosing tag by <h1> and add a class attribute with its value.

Another example with more attributes:

$attr = [
    'class' => 'dallas',
    'id' => 'larry',
    'aria-hidden' => 'true',
    'data-animation' => true,

echo $page->title()->kirbytextWrap('p', $attr);

Feel free to report bug or suggestion.
Download and docs: