You will need to add the current page object to the timber context using timber_context filter.
Something like this
add_filter('timber_context', 'bt_timber_add_to_context');
function bt_timber_add_to_context ($context) {
// add current page content
$context['page'] = Timber::get_post();
return $context;
}
That’s how I added it in my custom timber theme.
Now when you want to get the page content you can do this
{{ page.content }}
This is availalbe only if you use Timber::context() in your render/compile methods.
Basically if you use Timber::context(), one of the object properties will be page
Related Posts:
- Create custom page templates with plugins?
- Pass PHP variable to javascript
- Consuming an external API in WordPress?
- Is it possible to define a template for a custom post type within a plugin independent of the active theme?
- Is it possible to stop selected plugins from loading on certain template pages?
- Ways to have multiple front-page.php templates that can be swapped out?
- Creating a default Custom Post Template that a Theme can override
- WooCommerce – Load Templates From Plugin For All Template Files
- How can I add a custom header to a custom template in a plugin without using the theme folders
- Template plugin for blog posts? [closed]
- Custom url structure for custom template
- Developer plugin to echo template names/filepaths [closed]
- How do I add a template to a theme using a plugin?
- How do I make a wordpress plugin with menu item etc
- do_shortcode() doesn’t work if shortcode contained in variable, works if shortcode passed as string
- Get image URL from media library in input
- taxonomy_template filter do not loads custom taxonomy template properly
- Plugin shortcode won’t work on a custom template file [closed]
- Override comments.php template with plugin
- How to enqueue a theme style-sheet to my admin settings page?
- Woocommerce email template customization [closed]
- How to get the HTML until ?
- More than one text-domain is being used because of the included templates for plugins
- Can we use a webservice with WordPress?
- Should I fetch the data managed by a plugin by using its APIs or WordPress APIs?
- WP Post Template – Templates in own folder
- Register Page Template from Plugin
- List Category Posts rewrite necessitates rewrite of customised templates
- (FES EDD) New vendor submission page is blank
- Facebook Messager Plugin
- Use of Templates in a Plugin
- Add comments for template variables
- Render custom php template into string
- Perform internal redirect in WordPress?
- How WordPress is able to change locale without using setlocale
- How to use get_template part in the plugin?
- changing posts layout in ultimate member profile plugin
- Template filter for custom taxonomy terms
- how to force tag page layout to use same as search layout?
- Calling the_excerpt from inside a plugin template file
- Best practice for including plugin output in a template without using shortcode?
- How do I override plugin templates and stylesheets?
- WordPress as template engine
- Default taxonomy template in plugin, override in theme
- Plugin Admin Menu Boiler Plate
- Opening a JQuery modal window on click of a button with a JQuery plugin
- Pagination shows Same posts
- Custom form not showing in correct place on page
- Should meta boxes for specific pages be save in their own plugins?
- Call a function for social sharing
- Ajax Call in page theme not working?
- reCAPTCHA on page template without plugin
- How do I show content from a plugin using the template the site is currently working with?
- Woocommerce – Change Variable Product Add to Cart to behave like external product using Custom Field (link) [closed]
- Prevent plug-in scripts on a specific template?
- Pull comments from one page/post into another page/post?
- Multiple Post Thumbnails Plugin – Need help with code
- Show Homepage (only) Hits Count
- Wp-minify doesn’t seem to minify my JS code
- use EDD Content Restriction for restricting php in template
- Pass PHP variable to javascript
- How can I disable an attribute from a Gutenberg block included in a template via InnerBlocks?
- How to turn my WordPress site into a ready to deploy template?
- how to display a template.php in a shortcode
- WoCommerce Cart is not showing pricing
- Enqueue css to a third-party plugin template
- the_posts_pagination() not working if I add wp_head() to header.php
- Mobile Menu and Mobile Sidebar missing
- How to check if short code is present in template?
- WordPress hierarchy clarification, does post_type_archive take precedence over taxonomy-term archive?
- How to add post title to custom php?
- What are the disadvantages of using template_redirect for restrictions
- How to access Post Archive created by Elementor?
- Programmatically generate new pages for a site based on page template and content elements accessed via DB
- Call function with button and return response
- How to change the deafult template in WordPress plugin
- Customize plugin templates
- WordPress arrows dissapeared strange signs
- Why is WP template_include overwritting all templates rather than specified page?
- How to echo a plugin’s function into a template?
- WP plugin calls for custom pages
- Convert HTML5/CSS3 site to WordPress Theme (need a lot of plugins) or just use the API?
- show Visual form builder in the front end
- Fake Single WordPress Post (Page) Loop
- WordPress multisite haml templates
- How to make plugin work in each template in wordpress
- [Custom field template plugin] Upload limited to 20 inputs file
- Make a Custom template for a specific category in wordpress
- WP Customer Reviews call short code on another page [closed]
- WordPress show different custom post type
- Display HTML5 jQuery Audio Player On Front Page
- Template library for WordPress [closed]
- How to display content depending on the Woocommerce Product Category
- Is there a plugin or another way that can help me find out the underlying files of a page/post? [closed]
- How to make a Template page to show the information of different things Shop and Product page?
- How to provide page_template path in custom plugin using WordPress
- Cannot register a block in my Twig-based theme using Timber for WP
- Newspaper theme, custom query vars, & custom rewrite rules
- Is there potential plugin incompatibility if theme has no header.php and footer.php?
- Re-use date format on different template