Custom Fields
Re-Envisioned
Support MB Views Show map field (taxonomy) in single view

  • Creator
    Topic
  • #23471
    Resolved Eddie the Eagle
    Participant

    Hi Long

    I have a CPT (event) with a taxonomy connected to it and I have added an custom field (OSM).
    Now I would like to display the map of the taxonomy on the detail view of the CPT event.

    I have found the following PHP code. Unfortunately I can’t convert it into views.

    $term_id = get_queried_object_id();
    $value = rwmb_meta( $field_id, array( 'object_type' => 'term' ), $term_id );
    echo $value;
    

    I have tried the following in VIEWS:

    <h2>Map:</h2>
        <div class="maps">
            {% set term_id = mb.get_queried_object_id()%}
            {% set taxmap = mb.rwmb_meta( 'osm_veranstaltungsort' , {object_type: 'term'} , 'width=400px&height=400px&zoom=14', term_id )%}
            {{taxmap}}          
    </div>

    What am I doing wrong?
    Best regards
    Eddie

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

    Hi,

    The second argument of the helper function rwmb_meta() must be in one object like:

    {% set taxmap = mb.rwmb_meta( 'osm_veranstaltungsort' , {object_type: 'term', width: '600px'}, term_id )%}
    
    #23485
    Eddie the Eagle
    Participant

    Hi Long

    Thank you very much, that’s the solution.

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