@boochamoocha Doesn’t WooCommerce use default thumbnail images? In that case you probably can do (like in the Image Cookbook):
<img src="{{ post.thumbnail.src|letterbox(250, 250, '#FFFFFF') }}" />
Remarks
TimberImage
(except when you added Image
as a shorthand for TimberImage
yourself).resize()
defines how you want to crop the image. Instead, you need to use the letterbox
filter.{{ dump(yourvariable) }}
to debug variables.TimberImage()
objects from all types of files because that seemed to work. At some point the .src
method/property seemed to stop working for non-images though
TimberImage()
because not all of them are images. I also wouldn't want to handle all those files as default WP attachment objects, because I'd like to access the thumbnails easily with Timber features.
__()
, _x()
, _n()
and _nx()
in your Twig files, just like you would do use them in your PHP files.<button role="button" aria-label="{{ __('My Label', 'my-text-domain') }}">
works just like you would expect.We cannot get twig function {{ dump(record) }}
to work, possibly because DEBUG is not set to true, which is not configured the way WP normally does because in this case we use Azure/Docker (for a reason, long story).
So, how can I check on the frontend whether debug is true?
if ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) {
TimberHelper::function_wrapper( 'pc_debug' );
}
function pc_debug( $some ) {
PC::debug( $some );
}