Questions tagged [timber]
Timber is a WordPress plugin to develop themes using the Twig template language
493
questions
0
votes
0
answers
20
views
Blank page when using Timber + Heroic Knowledge Base plugin
PHP Version: 7.4.28
MySQL: 8.0.29
WordPress: 5.9.3
Timber: 1.19.1
I've installed Timber thru the backend upload page.
I do have a custom theme using Timber / Twig - never had an issue before, with ...
0
votes
1
answer
16
views
Timber - Pagination didn't work with default Wordpress query
I'm trying to display pagination in my default query on blog page.
So I have file called home.php with this code
<?php
use Timber\Post;
use Timber\Timber;
$post = new Post();
$context = Timber::...
0
votes
0
answers
27
views
Wordpress / Timber category pagination issue
I'm using Wordpress along with Timber and am having issues with pagination on my archive page. I have a custom post type of 'events' and then the regular posts which I called 'articles'. Both of these ...
0
votes
0
answers
18
views
Menu [Timber] in Wordpress
How to make a drop-down menu in Timber WordPress, the following is my code but is not showing as drop-down, also I am inserting an image how it looks now, the menu is horizontal menu
enter image ...
0
votes
0
answers
20
views
Should I use site.link or site.url in Twig/Wordpress? [duplicate]
Should I be using {{ site.link }} or {{ site.url }} in Twig/WordPress for my theme development? They both seem to do the same thing and wanted to make sure I was correct and consistent.
Thanks so any ...
0
votes
0
answers
16
views
What's the difference of these two (same?) functions in Timber?
I'm curious.
What's the difference between these two functions below that Timber uses?
$context['posts'] = new Timber\PostQuery();
and:
$context['posts'] = Timber::get_posts();
Am i right saying ...
0
votes
0
answers
26
views
Timber '|resize' with Imagify plugin
I am using Timber 1.19.1 with the image optimisation plugin Imagify.
Unfortunately, Imagify does not optimise images generated by the |resize filter in the twig, as the plugin only compresses the ...
0
votes
1
answer
23
views
Android Studio: Timber: automatically add the function name
Does anyone know a trick to include the function name in a Timber text/tag without actually having to type it? Here's what I do and I figured I might as well ask... (initRecognizer is the function's ...
0
votes
1
answer
82
views
Ouput ACF Color Picker Field Type from categories
I want to get the color of a category. In ACF I have created a color picker field type, which I can then adjust via Posts > Categories > Category.
How can I get the output of an ACF color picker ...
0
votes
0
answers
72
views
Updated Text in Post not Showing on Preview Page Link
I have a WordPress site that uses Timber v1.x (https://timber.github.io/docs/).
If I go the WP Admin page (for example https://example.com/about), edit some text in the default WP content field (...
0
votes
0
answers
29
views
Having trouble with a hierarchical Wordpress sidebar menu. The script always appends the slug so you can't navigate back up the hierarchy
The menu uses a toggle to drop down child pages. It's then possible to navigate to a child page, but getting back to the parent page, or a different parent page is impossible, since each time, the ...
0
votes
1
answer
100
views
Custom post type taxonomy not being replaced in ACF post object field output
I have a custom post type (Photos) and a taxonomy (Locations) setup on my client's website. The permalinks work correctly when accessed using the menus, search, and directly from the custom post type ...
0
votes
0
answers
58
views
How can I create pagination for cpt wordpress timber?
I have loop to load the cpt of an specific post type on a specific page. What is the best practice to create pagination for that?
I have twig file and controller php file, cpt created with cpt plugin, ...
0
votes
0
answers
108
views
How to check if current logged user is author of post
Im new to Timber/Twig.
I want to display "edit button" near posts that already logged in user is author of (wordpress).
Im using loop to display posts, if I use {{user.id} and {{post.author....
0
votes
1
answer
182
views
How do I get and set Advanced Custom Fields data as a variable in Timber $context to use in a post query?
I want to get and set the value of an ACF field into a variable in my home.php file and then use this as part of a query.
So, for example, if a user enters the word 'event' in the the field 'cat_name' ...
0
votes
0
answers
32
views
Need help to understand Timber cache
I'm looking for a way to use Timber cache methods to get optimise my website's performance.
Actualy, i try to use Cache Parts of the Twig File and Data
Here is my code
{% cache 'menu/legals' ...
0
votes
1
answer
72
views
How to check if at last post and navigate to first post
I have page arrows (Previous and Next ) on every single post however when I reach the last post I want to still keep the Next button which will link to the first post and vice versa if I'm on the ...
0
votes
1
answer
28
views
Timber footer returns svg?
I actually build a site with timber, below is my composer json :
{
...,
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"require": {
...
-2
votes
1
answer
83
views
Use <select> in Twig / Timber
I have the following code in a .twig WordPress template:
<select id="filter-assessment-year">
<option disabled selected hidden>ASSESSMENT YEAR</option>
<optgroup label=&...
0
votes
0
answers
17
views
Is there a performance hit when you use arrays for Timber render, includes, etc?
I'm trying to create a custom WordPress theme using Timber where any Timber template (layouts and includes as well as template) can be overridden by creating a file in templates/custom.
To accomplish ...
0
votes
1
answer
74
views
In Wordpress using a custom Timber/Twig theme how can I fetch .env variables in a twig file?
As the title says. I have a custom theme that is using timber plugin so has twig for its templates. But I am not sure how to fetch data from the env file to use in a twig file.
-1
votes
1
answer
110
views
Impossible to filter custom post in query using tax_query
First time than I use Timber and I'm looking for help to find a way to filter some custom_post with a taxonomy.
In this file single-news.php, I try to display in my custom posts (news) controller a ...
0
votes
0
answers
134
views
Timber + Woocommerce : display product categories
I'm trying to create a shop page and display all the woocommerce products categories rather than the products. With "Timber::get_terms('product_cat');" I'm able to get some informations ...
1
vote
1
answer
73
views
Getting the "Open link in a new tab" property from a WordPress menu item
In a typical menu item loop is there something like item.target when setting the 'Open link in a new tab' option?
I see the issue has been brought up before and is now available in Timber V2 but is ...
0
votes
1
answer
179
views
Timber + ACF - How to get get_row_index() working?
Problem: I would need to get the current layout index from flexible content field. ACF already have built-in functionality for this - https://www.advancedcustomfields.com/resources/get_row_index/
...
0
votes
0
answers
148
views
Convert Array of WP Post Objects to Timber Post Objects
I modified array of items from wp wp_get_nav_menu_items function.
I used that function because I want to have one dimensional array of menu items which are hierarchical btw.
[top menu item]
|- [child ...
0
votes
2
answers
258
views
Blank WP starter theme compatible with Blocks and Bootstrap
I want to refine my wordpress theme development process which is:
To make a unique-creative design with Adobe XD or Figma.
To convert it to static HTML using VS Code with Bootstrap.
In wordpress, ...
0
votes
1
answer
74
views
Can't get term or call functions
I'm migrating an old theme to a new Class-based setup with Timber. There is a Custom Post Type called "collection". In a loop, I output all collections on an overview page. Each count ...
0
votes
0
answers
54
views
Timber::render feed.rss.twig with XML content-type header
I have a custom Wordpress XML RSS Feed that is compiled from a my-feed.rss.twig Twig template.
Is there a way to set a Content-type: text/xml header in Timber::render?
At the moment the following ...
0
votes
1
answer
47
views
Does the size of Timber global $context has impact on performance
Trying to optimise website and was wondering does this have some impact.
I'm adding to $context some variables...
public function add_to_context( $context ) {
$context['query'] = $GLOBALS['...
1
vote
0
answers
40
views
Accessing Route parameters in advanced custom fields Gutenberg blocks callback function
I'm using Advanced Custom Fields' custom Gutenberg blocks and Timber to build out a WordPress site.
I have a few custom routes using Timber's router and would like to access the URL parameters (like :...
1
vote
0
answers
84
views
WP categories blog post pagination
I'm trying to paginate my categories blog posts. I'm using timber.
in my category.php i'm doing this:
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'numberposts' =&...
2
votes
1
answer
78
views
Post sorting issues in WordPress using Twig/Timber
So we have a custom Wordpress Pet Site in which we sort pet posts by the ACF field of litter_born and it all works fine until no posts show and then it will just throw a page error.
Here is the code ...
8
votes
1
answer
268
views
Setting a custom place holder image in twig/timber theme
So I am having a twig/timber issue where I have a difficult time getting a placeimage set, here is what I have so far:
{% set defaultimg = site.theme.link ~ '/images/placeimage.png' %}
and then later ...
0
votes
1
answer
164
views
With Wordpress in Maintenance Mode, how do we exclude the wp-login.php page?
So we added a custom maintenance page to our custom wordpress theme using ACF - but we somehow have to exclude the wp-login.php page or we won't be able to login to our website if Maintenance is on, ...
0
votes
1
answer
50
views
Is it possible to pass twig variables into templates?
I'm using the Timber plugin for my Wordpress site. For a little button component, i'm trying to pass the variable {{ site.link }} to use as my href.
Like so:
{% include 'component/icon-button.twig' ...
0
votes
1
answer
103
views
Out putting RAW ACF values in twig/timber unto page header for SEO purposes
So, from ACF I have created my own SEO fields in my custom WP theme, so I don't have to rely on a plugin, and I want to have the default values already filled out, so we don't always have be doing ...
0
votes
1
answer
453
views
Timber/Twig showing: "Fatal error: Uncaught TypeError: Argument 1 passed to Twig\CacheExtension\CacheStrategy.."
After seeing a critical error (white screen of death) on my live WordPress site, I turned on debugging in wp-config.php and see the following error message.
I have not changed anything on the site, ...
0
votes
0
answers
175
views
ACF Block made with Timber, will not render in the admin panel of Wordpress
I am using ACF Pro and Timber to build my Wordpress theme and I am having a problem with getting the block to render in the design view in the Gutenberg block editor consistently. I can edit the ...
1
vote
0
answers
484
views
Gulp Sass and Tailwind with Timber
I have a project setup for Timber Wordpress development and want to try using tailwind.
I have followed some tutorials but new to Gulp.
In my Gulp file I have imported Gulp Sass and I can see that in ...
0
votes
1
answer
48
views
How to Convert weeks into days in Twig/Timber Wordpress
I have a situation where I have a variable that is set to a number of weeks and I need to convert these weeks to total number of days, but can't seem to get things working: twigfiddle.com
Thanks, in ...
0
votes
0
answers
77
views
Custom template not loaded in Twig / Timber
I have a post type called Product and I'm trying to load a different template (extending my templates/default.twig) depending on product category :
product-gallery.twig if books category is checked
...
0
votes
1
answer
274
views
Timber Twig WebP compression level when converting images
I started using the towebp filter to convert images into webp format - very excited about that feature by the way :) While the images looked quite fine in several implementations I just compared the ...
0
votes
1
answer
117
views
Custom Checkout Page for Woocommerce in Timber
I create my custom theme like described in the docs:
https://timber.github.io/docs/guides/woocommerce/
When I now try to create a custom checkout page, this page doesn't call woocommerce.php. Any ...
1
vote
1
answer
129
views
How would I write multiple "if" conditions in one line in timber/twig?
I have a situation where I would like to write multiple "if" condition in one line such as example: {% if room_status == 'For Rent' and not 'Booked' %} this is obviously not working but you ...
0
votes
1
answer
98
views
Searching entire multisite post.link returns current blog url
On a WordPress Multisite installation using Timber the search form returns the correct post/pages but when using {{ post.link }} the slug is prepended with the current blogs url instead of the site ...
0
votes
0
answers
72
views
I need help displaying my custom Taxonomies on WordPress archive pages?
I am using Twig/Timber in my custom WordPress theme built and having a challenging time getting my posts to filter by custom taxonomy/terms, for example with the Taxonomy Type = tools I would like to ...
0
votes
0
answers
123
views
how to show images of different variation on single-product.twig
I'm new to timber and twig. I have a custom single-product.twig template that I need to add a functionality so when user change the variation on the product, the image change to the current variation. ...
0
votes
0
answers
60
views
Why is my Wordpress Timber component breaking the page?
I'm currently building a website with a number of components in Timber, however I have one specific component that breaks the page entirely on mobile and I'm unsure why.
I can only assume it's ...
0
votes
1
answer
70
views
setting context within twig template with timber value,
I am trying to set a variable with my twig template (I know this should be done in PHP, but I need to do it here).
The problem is that I am trying to set a dynamic twig variable value with set.
What ...