New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Actions and filters #69
Comments
Hmmm, interesting stuff. I feel like option #2 ( same reason I think I prefer #4 -- I feel like the Have you implemented these in yr fork already? |
Agreed. Added the "action"|do_action syntax to mimic the behaviour of functions, but do action feels much more natural. As for filters, I think apply_* is quite elegant, but counter-intuitive at first. Using apply_filters mimics the WP syntax closer and is as a bonus semantically nicer than the WP way itself ( 'take "this content" and apply filters' ). Will open a pull request! |
…ag,param1...). Closes timber#69.
I have been thinking about what to do with actions and filters in Timber. They are everywhere in WP development, so why not leverage them in Timber templates? Even though they are an open invitation for extra logic in your views, everything in WP hangs on them, so why not make them available in your templates.
I came up with the following implementations, but am not sure which would be best, maybe you have strong feelings for functions vs. filters. Anyway, here are my suggestions:
The text was updated successfully, but these errors were encountered: