Timber is a WordPress plugin to develop themes using the Twig template language
Questions tagged [timber]
518 questions
4
votes
3 answers
Passing a post ID to a Twig/Timber function
How do I pass a post ID to a Twig/Timber function like edit_post_link?
Reading the docs at https://timber.github.io/docs/guides/functions/#function-with-arguments
A function like edit_post_link will try to guess the ID of the post
you want to…

BlueDogRanch
- 721
- 1
- 16
- 43
4
votes
1 answer
WordPress + Timber w/ custom theme + routing - 404 page not rendering
I am creating a custom WordPress theme using Timber and Twig and I am having a hard time getting my custom 404 page to render.
Originally, each page on my website had a custom route defined in functions.php and my 404 logic was in index.php. This is…

Liz
- 1,008
- 5
- 19
- 49
4
votes
3 answers
How to parse Timber (twig) templates with poedit and detect quoted strings to translate
I want to parse twig templates for Timber with poedit and I need to translate quoted contents. The problem is that I can't find a parser that does not skip quoted content.
Example:
Does someone…

François Lefebvre
- 93
- 10
3
votes
2 answers
Using Relevanssi Query for Timber Pagination
I'm trying to find a way to pass the Relevanssi found number of posts into Timber pagination. Currently, it is using the default query's found number of posts instead of Relevanssi's.
My search.php template looks like this:
$searchQuery =…

Tyler Hall
- 363
- 1
- 2
- 7
3
votes
0 answers
get_fields is empty after inserting an ACF gutenberg block
we just integrated timber into our acf-gutenberg-block setting, and we love it. ;)
There is one thing that doesnt work.
Our ACF Blocks have prefilled values like a "dummy" headline.
But when a backend user adds a block into the gutenberg view, the…

Thomas Wegerer
- 31
- 2
3
votes
2 answers
Custom php file directory in Wordpress with Timber Twig
I am using Timber with Wordpress (version 5.4.2). I have installed Timber's starter theme as a boilerplate.
Timber leverages the Wordpress template hierarchy allowing you to create a custom PHP file for a given route.
Page.php (default in Timber…

yevg
- 1,846
- 9
- 34
- 70
3
votes
1 answer
Issue when adding second custom menu to global context
Issue when adding second custom menu to global context - Unsupported operand types in /app/wp-content/plugins/timber-library/vendor/twig/twig/lib/Twig/Environment.php(462)
I'm working on grabbing a second registered menu and adding it to a header…

Matt
- 31
- 3
3
votes
1 answer
Timber "resize" filter won't generate new image sizes
This piece of code (WordPress theme) using the "resize" of Timber filter won't generate the new size image and always returns the source image link instead.
No errors…

Víctor
- 850
- 7
- 19
3
votes
1 answer
Timber - list categories and their posts
I have a CPT ('vehicles') with custom taxonomy ('vehicles_category')
I have 4 categories (construction, road, waste, other) with numerous posts assigned to each of these categories.
I'm trying to list out each category with the posts assigned to…

mfos
- 101
- 1
- 8
3
votes
2 answers
Sorting a repeater field from Advanced Custom Fields in PHP and Timber/Twig
I'm trying to sort the output of a repeater field from the WordPress plugin Advanced Custom Fields (ACF) using the WordPress Timber plugin implementation of Twig 1.34. The basic PHP example to sort from ACF below is from…

BlueDogRanch
- 721
- 1
- 16
- 43
3
votes
1 answer
Pagination in timber
I am using Timber, and currently trying to get pagination working as per the Timber docs, though so far, without success. Below is my custom archive php file:
global $paged;
if (!isset($paged) || !$paged){
$paged = 1;
}
$context =…

wickywills
- 4,024
- 2
- 38
- 54
3
votes
2 answers
PHP Fatal error: Uncaught Error: Cannot access property started with '\\0'
So I'm using Timber v0.22.5. I have it currently running on my local and a dev environment right now. Everything is running great no issues. Both environments are running PHP 5.5.9.
I just migrated it to my production server which is running PHP…

j0hnstew
- 709
- 8
- 25
3
votes
1 answer
Best practices for Timber and WordPress with multilanguage support
Problem
As I've seen in the Timber documentation it is possible to add multilanguage support like this:
// Set language to French
putenv('LC_ALL=fr_FR');
setlocale(LC_ALL, 'fr_FR');
// Specify the location of the translation…

safari
- 7,565
- 18
- 56
- 82
3
votes
1 answer
Timber: Access Advanced Custom Field From Another Page
I am trying to access ACF data from another page to be displayed on another using Timber (Twig).
The ACF name is the_unstrung_hero in the "About" page (id = 7).
page-home.php:
user742030
2
votes
0 answers
Display search result on the same page of the search box
I am trying to build a component that looks like a WooCommerce product page, it should have a filter(category), a search box, and pagination, and a dropdown that users can select how many posts they want to display on the page. Currently, I am using…

xianzhe yang
- 21
- 1