Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Steve Pfisterer
    @stevep
    The function is public yet the docblock doesn't have api or internal in it.
    Dmitry Badanin
    @boochamoocha

    Hi all. I'm trying to resize thumbnail on woocommerce product tease page, but nothing happens.

    <img src="{{ Image(post._thumbnail_id).src | resize(250, 250, '#FFFFFF') }}" />

    How to debug this issue?

    Lukas Gächter
    @gchtr

    @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

    • If you’ve got an image attachment id that you want to convert to a Timber Image, you might want to use TimberImage (except when you added Image as a shorthand for TimberImage yourself).
    • You can’t use as hex color value with the resize filter. The third parameter for resize() defines how you want to crop the image. Instead, you need to use the letterbox filter.
    • You can always use {{ dump(yourvariable) }} to debug variables.
    Dmitry Badanin
    @boochamoocha
    @gchtr Thank you. I used you code snippet and got error PHP GD not installed. Now problem solved.
    Tomi
    @tnottu
    Is there any "official" way to handle file attachments, which are not images? For images there is TimberImage() but can/should I wrap other files to some sort of object as well?
    Previously I just made TimberImage() objects from all types of files because that seemed to work. At some point the .srcmethod/property seemed to stop working for non-images though
    Now I'm wondering what would be the best way to deal with an ACF repeater which has file fields. I would like to be able to get the file url in the same way for all items, but now it seems I can't or it's a bit tricky.
    I mean, I can't wrap all items in 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.
    Tomi
    @tnottu
    I could do some checks and conditions to handle images and non-images differently, but ... well, that's exactly what I'm trying to avoid.
    Steve Pfisterer
    @stevep
    Looks like Timber\Image extends Timber\Post. But looking even further, it looks like the Timber\Image::src method should be checking to see if it is an image or not, and returning the url appropriately https://github.com/timber/timber/blob/master/lib/Image.php#L444
    Tomi
    @tnottu
    Ah, and that fix has been made only 3 days ago and the new 1.3.0 release is only 20 hours old... it's not on wordpress.org yet
    thank you for pointing me in the right direction, i just need to wait until the new release is available @stevep
    Steve Pfisterer
    @stevep
    Mmm ok. Well at least it should be working soon :)
    no prob
    Lukas Gächter
    @gchtr
    Good news for i18n and Timber: Twig support arrived in Poedit. You can download the latest beta version of Poedit 2 from https://poedit.net/download. What this means:
    • You can use __(), _x(), _n() and _nx() in your Twig files, just like you would do use them in your PHP files.
    • No more custom extractors based on the Python parser. No more Twig-Gettext-Extractor. Disable your custom extractor and you’re good to go.
    • Translations inside HTML tags that didn’t work with custom extractors are now recognized. E.g. <button role="button" aria-label="{{ __('My Label', 'my-text-domain') }}"> works just like you would expect.
    Dan Burzo
    @danburzo_twitter
    WOHOOO
    Marko Bolliger
    @cannap
    hm i use wpml
    is it faster when i use real po files?
    woa wpml is complicated
    nvm
    wpml does not save in the theme folders everything ok then :D
    Marko Bolliger
    @cannap
    Evert Albers
    @evertalbers

    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?

    The rest of the site seems to be working fine, BTW.
    Evert Albers
    @evertalbers
    (And just after posting I have found a workaround, but I'll leave the question here)
    Steve Pfisterer
    @stevep
    yeah it seems like WP_DEBUG needs to be set to true https://github.com/timber/timber/wiki/De…
    otherwise use the print_r filter
    Marko Bolliger
    @cannap
    i use php console for this
    its awesome
    and then i do
    if ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) {
        TimberHelper::function_wrapper( 'pc_debug' );
    }
    
    
    function pc_debug( $some ) {
        PC::debug( $some );
    }
    and in timber {{ pc_debug(whatEver) }}
    and get the stuff in my console in chrome
    but dont forgot to remove all pc_debug things in production
    or maybe just add else and create a new pc class with a static debug and just return nothing
    Steve Pfisterer
    @stevep
    Neat! Better than littering the DOM
    Marko Bolliger
    @cannap
    @stevep you acf builder look interesting
    i hate this big ass arrays
    Steve Pfisterer
    @stevep
    Thanks, me too, and I hate using the UI
    Marko Bolliger
    @cannap
    yea the problem is when i use the ui in dev
    i need the php code later
    i dont merge my dev db with the production db xD
    i was thinking about create a
    small electron app
    to generate this
    Steve Pfisterer
    @stevep
    i like having it committed to the source code repository
    Marko Bolliger
    @cannap
    i need a acf cleaner or something
    in wpml i see very old fields
    this sucks