Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Metabox Array

<?php

$args = array(
    'post_type' => array( 'photo' )
);
// The Query
$the_query = new WP_Query( $args );
 
// The Loop
if ( $the_query->have_posts() ) {
    echo '<ul>';
    while ( $the_query->have_posts() ) {
        $the_query->the_post();
        echo '<li>' . get_the_title() . '</li>';
        $images = rwmb_meta( 'my_field_id', ['size' => 'thumbnail'], get_the_ID() ); ?>
        <h3>Uploaded images</h3>
        <ul>
            <?php foreach ( $images as $image ) : ?>
                <li><img src="<?= $image['url']; ?>"></li>
            <?php endforeach ?>
        </ul>
        <?php
    }
    echo '</ul>';
} else {
    // no posts found
}
/* Restore original Post Data */
wp_reset_postdata();
Source by support.metabox.io #
 
PREVIOUS NEXT
Tagged: #Metabox #Array
ADD COMMENT
Topic
Name
6+1 =