Hello,
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.
Usage: $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.
Thanks for the informations, can you also post the Blueprint part needed? So I can setup the test environment fastly.
At this time I have not so much time but I promise to give a look when I’m free!
Ping @timoetting from the kirby-builder plugin, in case if he know why this is happening.
I also made a test without the Kirby Builder, but received the same result.
I updated to the newest Kirby Version 3.3.6
the template part: snippets > blocks > paragraph.php
The result is not that surprising, because the method takes all field content and wraps it inside the given tag. So it is only intended to be used with single paragraph text.
Not with this method, no. As I said, I’m not quite sure what the intended use is, but if you look at the source code, you will see that it removes all p tags and then wraps the resulting code within the given tag, which doesn’t make any sense for more than a single paragraph.
Hey texnixe,
thank you for squeezing in between.
I mostly use http://tachyons.io/ for theming, so I thougt the ktW plugin is a good solution to give the class parameter to the paragraph, but also use all formattings from the toolbar/textfeld.
Is there an other way. Cause I am a noCoder, your previous link does not help me that much!
Then you can create a plugin. Create a new folder in site/plugins, e.g. site/plugins/preplace and inside that folder an index.php file. In that index.php, put the following code: