Custom data in MB View Shortcode

Support MB Views Custom data in MB View ShortcodeResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #38488
    Guillaume LORAINGuillaume LORAIN
    Participant

    Hello.

    I would like to use MB View to display content of a specific post.
    I see it's possible to add custom data into the shortcode of the view, so is it possible to write the post ID in a custom data to filter for this post ?

    My goal is to add this view into another post.

    Thanks.

    #38492
    Guillaume LORAINGuillaume LORAIN
    Participant

    I tried this, but it gave me a fatal error
    {% set args = {{ ID }} %}
    {% set post = mb.get_post( args ) %}
    {{ post.post_title }}

    #38495
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Please remove the double curly brackets if you assign a value to a variable. It is used to print out the value.

    {% set args = my_post_id %}

    and the shortcode should be [mbv id="your-view-id" my_post_id="123"]

    You can follow the documentation to know how to use Twig https://twig.symfony.com/doc/3.x/templates.html

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