Single Image - Custom Post Type - No Data

Support MB Views Single Image - Custom Post Type - No DataResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #30792
    uptwouptwo
    Participant

    Hey,

    i've created a view and everything is working so far. The only problem is that I can't get any data for a custom field (single image), all other fields work strangely and I don't know where the error comes from. See code and screenshot:

    {% set args = { post_type: 'mitarbeiter', posts_per_page: -1 } %}
    {% set posts = mb.get_posts( args ) %}
    {% for post in posts %}
    
    <div class="sec-mitarbeiter-container">
        <img class="sec-mitarbeiter-image" src="{{ post.mitarbeiter_profilbild.full.url }}" alt="{{ post.mitarbeiter_profilbild.full.alt }}" title="{{ post.mitarbeiter_profilbild.full.title }}">
        <p class="sec-mitarbeiter-name">
            {{ post.post_title }}
        </p>
        <p class="sec-mitarbeiter-title">
            {{ post.mitarbeiter_titel }}
        </p>
        //more Code here, but deleted, don't want to expand the post further
        <a class="sec-mitarbeiter-social-link" target="_blank" href="{{ post.mitarbeiter_linkedin_link }}" rel="noopener"> {{ post.mitarbeiter_linkedin_link }}</a>
    </div>
    {% endfor %}
    <div class="sec-mitarbeiter-container">
        <img class="sec-mitarbeiter-image" src="{{ post.mitarbeiter_profilbild.full.url }}" alt="{{ post.mitarbeiter_profilbild.full.alt }}" title="{{ post.mitarbeiter_profilbild.full.title }}">

    Isn't working, see screenshot:
    https://ibb.co/1TJhYS0

    #30794
    uptwouptwo
    Participant

    SOLVED

    https://support.metabox.io/topic/mb-view-by-shortcode/

    Solved it by myself. Could it be possible to automatically insert the missing line in the next update? Or give a tooltip?:
    {% set image = mb.rwmb_meta( 'field_id', '', post.ID ) %}

    #30797
    Long NguyenLong Nguyen
    Moderator

    Hi,

    It has been already added in the documentation, please find it here https://docs.metabox.io/extensions/mb-views/#custom-query

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