A series of twig filters to use in Timber x WP development
{{ value|slug }}
Returns a slugified version of the string. "This is a string" -> this-is-a-string
{{ array|shuffle }}
Returns the array in shuffled/random order
{{ image|svg }}
SVG inliner, replaces the instance with its svg code
{{ field|iframsrc }}
Extract the src portion from an iframe, eg ACF oembed field
{{ field|iframsrc }}
Extract the Youtube/Vimeo video ID from an iframe, eg ACF oembed field
{{ array|sortby(key, order) }}
Sort an array by key, asc/desc
{{ file|pdf }}
Recover the autogenerated PDF preview in its default size
{{ file/image|fbv }}
Returns the name of the Filebird folder of the file (requires plugin: FileBird Pro)
{{ 'path'|ondisk }}
Returns true if path exists on the server (to use with static files)
{{ 'path'|size(2) }}
Converts bytesize to a readable unit. (par) sets decimal precision
{{ uniqueid() }}
Generates a unique ID
{{ request }}
Server request powered by Laminas\Diactoros\ServerRequestFactory