Custom Fields
Re-Envisioned
Support MB Views field from settings page not displaying on frontend

  • Creator
    Topic
  • #29382
    jimimac
    Participant

    Hi,

    I've created a settings page and some custom fields. I then created a view where I have added the custom fields by clicking on the insert field button.

    I've put the shortcode into the page I want the info to show on but the values from the field arent displaying on the frontend. Im not sure why, if i use fields from other settings pages they display fine on the front end.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #29383
    jimimac
    Participant

    here's my view code...

    <div style="width: 100%; display: flex; flex-direction: row;">
        <div class="lesson-prices">
            <p>
                30 mins
            </p>
            <p>
                60 mins
            </p>
        </div>
        <div class="lesson-prices">
            <p>
    
    {% set field = attribute( site.tuition, '30mins' ) %}
    {{ field }}
            </p>
            <p>
    {% set field = attribute( site.tuition, '60mins' ) %}
    {{ field }}
            </p>
        </div>
    </div>
    #29405
    Long Nguyen
    Moderator

    Hi,

    You can use the helper function rwmb_meta() via the proxy mb to get the field value from the settings page.

    {{ mb.rwmb_meta( 'field_id', {object_type: 'setting'}, 'option_name' ) }}

    Get more details here https://docs.metabox.io/extensions/mb-settings-page/#getting-field-value

    #29455
    jimimac
    Participant

    would i just replace the 'field_id' part with the actual field id when editing the view or would i need to set an option name too?

    #29459
    Long Nguyen
    Moderator

    Yes, you need to change field_id and option_name to your actual field ID and settings page option name.

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