Custom Fields
Re-Envisioned
Support MB Views Link between fields

  • Creator
    Topic
  • #26575
    Resolved Igor Gouvêa
    Participant

    Hello

    I'm not able to show a date.

    Scenario:

    I have a group of custom fields (Prazo da obra) with 4 fields (date field), inside the Post Type w2gm_listing

    In the post-type Diário de obra, there is an ID field of w2gm_listing.

    I created a vision. In it I try to print the date of the post type w2gm_listing. But it prints the current date. Probably because you are not finding a link between the tables.

    Would you like to know how to show that date?

    Obras (date = 10/03/2021 and 30/30/2021)
    https://cutt.ly/RxjT2gj

    Diário de obras
    https://cutt.ly/AxjT5KA

    View code (date = 22/03/2021 and 22/03/2021)
    https://cutt.ly/VxjYyPa

    View Diário de obras
    https://cutt.ly/sxjYsEL

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #26585
    Long Nguyen
    Moderator

    Hi Igor,

    You can use the helper function rwmb_meta() to get the field value base on the obra ID. For example

    {{ mb.rwmb_meta( 'field_id', '', post.obra.ID) }}

    #26587
    Igor Gouvêa
    Participant

    Thank you so much!

    #26591
    Igor Gouvêa
    Participant

    Can you help me with one more thing?

    I'm showing you the day of the week. But it's showing in English. I would like to show it in Brazilian Portuguese.

    It's possible?

    I'm using it like this:

    {{post.data_do_diario | date ('l')}}

    #26592
    Igor Gouvêa
    Participant

    I will also need to add 3 days to the date. How do I do that?

    #26601
    Long Nguyen
    Moderator

    Hi,

    Please follow this document of Twig to show the date format https://twig.symfony.com/doc/3.x/filters/date.html.

    #26603
    Igor Gouvêa
    Participant

    Thank you!

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