Skip to content

Releases: timber/timber

0.16.0

26 Nov 21:05
Compare
Choose a tag to compare
  • TimberTheme is now available in default context as .theme
  • Post meta now respects arrays (watch out for some possible compatiblity issues here)
  • Template loads now work for parent/child themes in Windows (thanks @matthewsoares)
  • Better method for removing 404 body class on manual redirects (thanks @mgmartel)

Support for post_format

15 Nov 22:34
Compare
Choose a tag to compare
  • Need to get a post format? easy: {{post.format}}

0.15.4

15 Nov 05:24
Compare
Choose a tag to compare
  • More improvements to filters to support external integration with Pods and other WP frameworks
  • Fixed bug on date internationalization (thanks @slimndap)
  • Fixed bug on using existing image sizes (thanks @matthewsoares)
  • Fixed bug on homeurl vs siteurl (thanks @ciarand)
  • Added a cache lock to the TimberHelper::transient method
  • Added an in-development version of a TimberArchives object

Update to Twig, Comment Gravatars

07 Nov 14:23
Compare
Choose a tag to compare
  • Upgreaded to Twig 1.14.2
  • Added composer integration
  • Bunch of new tests
  • Comments now support gravatrs (thanks @asecondwill)
  • Moved ACF integration into its own file. It now interacts via hooks instead of in-line
  • A few misc. bugs and extra sanity checks

Image Sizes, Bug fixes

31 Oct 04:25
Compare
Choose a tag to compare
  • You can now grab an image size via it's name: {{my_image.src('medium')}} or {{post.thumbnail.src('large')}} (thanks @mgmartel)
  • Fixed a caching error (@mgmartel)
  • Some objects used manual code to generate links, they now use WP's built-in ones
  • Small fix so that you can do {{menu_item.name}} in all situations
  • TimberTheme is in alpha here. A better way to get theme info so it's all wrapped in an object

Hotfix

28 Oct 03:39
Compare
Choose a tag to compare

Hot fix on post.next and post.prev which were transposed.

Caching, Changes to Render + More Caching

23 Oct 19:17
Compare
Choose a tag to compare

Huge improvements coming in this release of Timber. Here's the big stuff:

Caching:

@mgmartel did some great work on caching. Now when go to render, you can set an expires time (in seconds):

Timber::render('single.twig', $data, 1200)

There are several different caching methods you can send:

Timber::render('single.twig', $data, 1200, TimberLoader::CACHE_USE_DEFAULT)
Timber::render('single.twig', $data, 1200, TimberLoader::CACHE_SITE_TRANSIENT)
Timber::render('single.twig', $data, 1200, TimberLoader::CACHE_TRANSIENT)
Timber::render('single.twig', $data, 1200, TimberLoader::CACHE_OBJECT)

... if you send nothing (as the first example) it will default to CACHE_USE_DEFAULT which is actually transient. WordPress transients first use a persistent object cache (if you have it enabled) or fallback to using the database cache. I've noticed great performance boosts from this, giving me 50% - 65% decrease in rendering time. There are slight benefits to object cache (speed-wise), but the gains are very similar for DB cache

In-Template Caching

You can also use the {% cache %} tag inside of a .twig file to cache parts of the template. @mgmartel explains the details


Changes to Timber::render

Warning: Breaking Change That said, this is an edge-case. It used to be that the third argument for Timber::render was $echo (which defaulted to true). In some circumstances you might have had it just return the rendered template w/o echo'ing so that you could store it separately. Now, you can do this with Timber::compile :

$megamenu = get_my_mega_menu();
$data['megamenu_rendered'] = Timber::compile('megamenu.twig', $megamenu);
Timber::render('page.twig', $data, 3600);

Post next/prev

@thisislawatts contributed next/prev post methods. Inside of a post object you can do:

{{post.get_next}}

... to return the next post (and also do {{post.get_next.title}}, etc.)

Misc

  • @daslicht made post.get_preview a little simpler for when you want to omit the "read more"
  • Misc cleanup to keep making things more consistent from object-to-object.
  • Some small internal caching things to prevent extra queries

Timber Debug Bar integration; TimberTerm and TimberMenu fix-up

18 Oct 23:48
Compare
Choose a tag to compare
  • Added hooks to play nicely with Timber Debug Bar
  • Fixed-up Timber Term aliases, link, path, etc.
  • TimberMenu is now more foolproof (accepts slugs, IDs, names, or nadda)
  • Add DB queries now get properly prepared
  • Supports custom author permalinks
  • Simplified TimberPost processing; shaved some processing time off

Better ACF Integration, More Routes Improvements

09 Oct 18:29
Compare
Choose a tag to compare
  • More flexiblity for custom routes (thanks @mgmartel)
    #75
  • Added function wrappers for core objects (TimberPost, TimberImage and TimberTerm). This greatly helps when you need to have retrieved custom fields or repeaters interpreted as posts or terms:
<img src="{{TimberImage(post.my_custom_image_id).src}}" />
  • Renamed "WPHelper" to more namespace-friendly "TimberHelper." Don't worry old WPHelper calls will still work, but that class will be deprecated in an upcoming version.
  • Added function_wrapper helper to execute functions where they are placed in the template as opposed to when they are generated (@mgmartel)
    #77
  • You can now have custom fields processed via post.get_field('my_custom_field'). This is a huge help for using things like Advanced Custom Fields' repeater.
  • Performance improvements

New Actions/Filters/Functions and Routes

02 Oct 06:14
Compare
Choose a tag to compare
  • Added comprehensive support for actions and filters (thanks @mgmartel)
  • Rewrote routing to template to be 100% harmonious with WordPress (thanks again @mgmartel)
  • Fix to some pagination errors when using a custom rewrite on a taxonomy (thanks to @kylehotchkiss)
  • Fixed issue with stripping the ellipses on a preview (thanks to @Bryanscode)
  • Functions now work more logically, example: {{function('my_special_function', 'arg1')}}