Created
September 11, 2014 13:56
-
-
Save fatpixelstudio/c1d4901776d5febe6ddf to your computer and use it in GitHub Desktop.
Add a widont tag to your kirbytext for Kirby v2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Widont | |
* ---- | |
* Use widont function from kirby toolkit helpers (based on str::widont) | |
* | |
* What it does: | |
* If text contains more than 3 spaces, replace last space by a  : | |
* | |
* Usage: | |
* (widont: this is a really long but awesome title) | |
*/ | |
kirbytext::$tags['widont'] = array( | |
'html' => function($tag) { | |
$text = $tag->attr('widont'); | |
return widont($text); | |
} | |
); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment