Created
December 8, 2024 20:17
-
-
Save topher1kenobe/4ede89488143bbd78168f15c8528e2ac to your computer and use it in GitHub Desktop.
Using MetaBox.io to create subsgroups.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$groups = rwmb_meta( 'ie-slider-sliders' ); | |
foreach ( $groups as $group ) { | |
// Field slider: | |
$subgroups = $group[ 'slider' ] ?? ''; | |
foreach ( $subgroups as $subgroup ) { | |
// Field title: | |
echo $subgroup[ 'title' ] ?? ''; | |
// Field image: | |
$image_ids = $subgroup[ 'image' ] ?? []; | |
?> | |
<h3>Uploaded images</h3> | |
<ul> | |
<?php foreach ( $image_ids as $image_id ) : ?> | |
<?php $image = RWMB_Image_Field::file_info( $image_id, [ 'size' => 'thumbnail' ); ?> | |
<li><img src="<?php echo $image['url']; ?>"></li> | |
<?php endforeach ?> | |
</ul> | |
<?php | |
// Field caption: | |
echo $subgroup[ 'caption' ] ?? ''; | |
// Field description: | |
$values = $subgroup[ 'description' ] ?? ''; | |
foreach ( $values as $value ) : | |
echo do_shortcode( wpautop( $value ) ); | |
endforeach; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment