Custom Fields
Re-Envisioned
Support Meta Box Builder Image Size Using Twig / Block Builder

  • Creator
    Topic
  • #22540
    Resolved David Newton
    Participant

    This should be pretty simple, but we’re still not quite finding how to make it work. We just need to control the size of an image that is being added via a field and then rendered with Twig.

    If we load it as {{ single_image_psweo3wlxf }} then it loads a thumbnail size image. How do we load it as some other WordPress/custom image size?

    Thanks for your help!

    David Newton

Viewing 3 replies - 11 through 13 (of 13 total)
  • Author
    Replies
  • #27043
    Long Nguyen
    Moderator

    Hi Robert,

    Can you please share the code that creates the block and custom fields? I will take a closer look and check it on my site.

    #27069
    Robert
    Participant

    Hello,

    This is the part of code, that works but displays only small thumbnail:

    
    <div class="wp-block-column is-vertically-aligned-top" style="flex-basis:25%">                <figure class="wp-block-image size-large">{{ zdjecie_produktu }}</figure>
    </div>
    

    What I want to do, is use medium image – thats what I tried, but it does not work:

    
    <div class="wp-block-column is-vertically-aligned-top" style="flex-basis:25%">                <figure class="wp-block-image size-large"><img src="{{ zdjecie_produktu.medium.url }}"></figure>
    </div>
    

    The field ‘zdjecie_produktu’ is just a regular ‘Single Image’ custom field, thumbnail size is set to ‘Medium’. No other customizations are made.

    As I mentioned, when I try to output the complete array, I just get ‘1’ as the output.

    #27084
    Long Nguyen
    Moderator
Viewing 3 replies - 11 through 13 (of 13 total)
  • You must be logged in to reply to this topic.