Skip to content
Kirby plugin to get rid of the kirbytext() <p> enclosing tag, or replace them and add HTML attributes. It Keep the kirbytag working.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
vendor
.editorconfig
.gitignore
.prettierignore
LICENSE.md
README.md
banner-kirbytextwrap.png
composer.json
config.php
index.php
kirbytextWrap.php
package-lock.json
package.json

README.md

KirbytextWrap plugin for Kirby

GitHub release License Kirby Version_2 Kirby Version_3

Kirby Plugin to remove or replace the <p> </p> enclosing tag and set HTML attributes. This will keep your kirbytag working.
Support both Kirby 2 and Kirby 3 version!


banner

How it works?

In your template, $page->title()->kirbytextWrap() will give you the same as kirbytext() without the <p> enclosing tag. This work also with the short ktw() alias.

Do much more

$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.

Put as many attributes as you want, you better create a variable for your array of attributes.

<?php
$attr = [
    'class' => 'dallas',
    'id' => 'larry',
    'aria-hidden' => 'true',
    'data-animation' => true,
];

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

Yeah cool but how to install?

You can install the kirbytextWrap plugin manually, with CLI, through Git submodule or with Composer.

  • Manually:
    Just download your desired version through the releases page, unzip and place the given folder into the site/plugin directory and rename it to kirbytextWrap.

  • Kirby CLI:

    kirby plugin:install yoanmalie/kirbytextwrap

    ⚠️ This will just work for Kirby 2 has CLI was removed on Kirby 3.

  • Git submodule:

    git submodule add https://github.com/yoanmalie/kirbytextwrap site/plugins/kirbytextWrap
    git submodule update --init --recursive
  • Composer:

    composer require yoanmalie/kirbytextwrap

Contributing

If you see a typo, or found a bug, please let me know! Share also your ideas through the issues tab.
Thanks for your help.

Clone this repo and run npm install.

git clone git@github.com:yoanmalie/kirbytextWrap.git
npm install

On each commit, Prettier will be run.

Credits

🤚 High five to @judbd who give me this plugin idea.
🎩 Hat tip to Jannik with his kirbytextRaw plugin who helped me when started to develop this plugin!

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.