Show map field (taxonomy) in single view

Support MB Views Show map field (taxonomy) in single viewResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #23471
    Eddie the EagleEddie 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

    #23479
    Long NguyenLong 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 EagleEddie the Eagle
    Participant

    Hi Long

    Thank you very much, that's the solution.

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