jarednova/timber — pull request #338 by aristath (2014-09-17 07:55:11+00:00)
Title: Add a 'timber_output' filter

This will allow us to filter the output anyway we like, further controlling our markup.
For example this function will add `data-pjax` to all internal links using this filter:

```php
function add_pjax_internal_links( $output ) {

// convert to array so we can skip the

$output_array = explode( '

', $output );

// Add pjax-data to internal links
$output_array[1] = str_replace( 'href="/', 'data-pjax href="/', $output_array[1] );
$output_array[1] = str_replace( 'href="' . get_home_url(), 'data-pjax href="' . get_home_url(), $output_array[1] );

// convert array back to string
$output = implode( '', $output_array);

return $output;

}
add_filter( 'timber_output', 'add_pjax_internal_links' );
```