I typically add a truncate function, trunc_chars
. I have always put in lib/extras.php
. Now that the file is name spaced, how would I use the function in, say content-page.php
?
Easiest way to do this is to add this to the top of content-page.php
…
<?php use Roots\Sage\Extras; ?>
I’ll probably end up making a custom.php
functions file and end up making a new namespace for my particular project, and putting project-specific code in there, but the above should work!
1 Like
Other alternative is to just reference the function with the namespace:
Roots\Sage\Extras\trunc_chars('foo');
1 Like