How to write with MB views

Support MB Views How to write with MB views

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #48689
    369cycle369cycle
    Participant

    The following taxonomy is category, how to write using MB views

    <?php $values = rwmb_meta( 'wysiwyg001', [ 'object_type' => 'term' ], get_queried_object_id() ) ?>
    <?php foreach ( $values as $value ) : ?>
    	<?php echo do_shortcode( wpautop( $value ) ) ?>
    <?php endforeach; ?>
    #48690
    369cycle369cycle
    Participant

    sory this

    $term_id = get_queried_object_id();
    $value = rwmb_meta( 'wysiwyg001', ['object_type' => 'term'], $term_id );
    echo $value;
    #48691
    PeterPeter
    Moderator

    Hello,

    You can use the proxy mb. to call the PHP function in the View template. For example:

    {% set term_id = mb.get_queried_object_id() %}
    {% set value = mb.rwmb_meta( 'wysiwyg001', {object_type: 'term'}, term_id ) %}
    {{ value }}

    Refer to this topic https://support.metabox.io/topic/how-to-get-field-value-in-the-settings-page/#post-46109
    and documentation https://docs.metabox.io/extensions/mb-views/#running-php-functions

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