Alignment doesn't works

Support MB Blocks Alignment doesn't worksResolved

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #47100
    HeaveHeave
    Participant

    I am using metabox block through mb views.
    i allow alignment center/left/right in mb custom field

    i have the option in gutenberg but what ever i do, there is no change in code on front end.

    what am i missing ?

    #47106
    PeterPeter
    Moderator

    Hello,

    You need to add the align attribute to the block template and create some custom CSS code to style the content with the align selection. For example:

    <p class="{{ align }}">{{ block_description }}</p>

    screenshots https://imgur.com/a/wMpKA5b

    and please follow the documentation https://docs.metabox.io/extensions/mb-blocks/#render_callback

    #47129
    HeaveHeave
    Participant

    ok thx

    #47130
    HeaveHeave
    Participant

    i am using views to code the block, and {{ align }} seems to get nothing

    #47148
    PeterPeter
    Moderator

    Hello,

    If you use the View template, you can access the align attribute via the attributes variable. Here is an example:

    Print attributes: {{ attributes.align }}

    #47154
    HeaveHeave
    Participant

    Hi peter, thanks :
    where can i see that in doc ?

    #47155
    PeterPeter
    Moderator

    Here you go https://docs.metabox.io/extensions/mb-blocks/#using-mb-views
    Notice the sample code:

    <div {{ mb.get_block_wrapper_attributes() }}>
        <img class="testimonial__image" src="{{ attributes.image.full_url }}">
        <div class="testimonial__body">
            <div class="testimonial__content" style="min-height: 50px;">
                <InnerBlocks />
            </div>
            <div class="testimonial__author">{{ attributes.name }}</div>
        </div>
    </div>
    #47156
    HeaveHeave
    Participant

    thanks !

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.