I am using Custom MetaBoxes 2 to create an images uploader field.
Here is the code for the metabox:
$meta_boxes['home_page_slider'] = array(
'id' => 'home_page_slider',
'title' => __( 'Home Page Slider', 'cmb2' ),
'object_types' => array( 'page', ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'show_on' => array( 'id' => array( 5, ) ), // Specific post IDs to display this metabox
'fields' => array(
array(
'name' => __( 'Slider Images', 'cmb2' ),
'desc' => __( 'Upload or add multiple images/attachments.', 'cmb2' ),
'id' => $prefix . 'slider-images',
'type' => 'file_list',
'preview_size' => array( 100, 100 ), // Default: array( 50, 50 )
),
)
);
How can I retrieve the images uploaded to this field, but with a specific size (for example "Full") , and display those images on the front-end on the following HTML markup?
<ul class="slides">
<li>
<img src="images/awn1.jpg" />
</li>
<li>
<img src="images/awn2.jpg" />
</li>
<li>
<img src="images/awn3.jpg" />
</li>
</ul>