<pre>Array
(
[0] => Array
(
[_type] => test-1-1
[test-1-1-1] => Название раздела №1
)
[1] => Array
(
[_type] => test-1-1
[test-1-1-1] => Название раздела №2
)
[2] => Array
(
[_type] => test-2
[test-2-1] => Уровень первый вариант №2
[test-3] => Array
(
[0] => Array
(
[_type] => test-3-1
[test-3-1-1] => Уровень второй вариант №1
)
[1] => Array
(
[_type] => test-3-1
[test-3-1-1] => Уровень второй вариант №2
)
[2] => Array
(
[_type] => test-3-1
[test-3-1-1] => Уровень второй вариант №3
)
)
)
)
</pre>
<?php $blocks = carbon_get_post_meta( get_the_id(), 'test-1'); ?>
<?php if (!empty($blocks)): ?>
<?php foreach ($blocks as $block): ?>
<?php switch( $block[ '_type'] ) {
case 'test-1-1' : {
?>
<span class="solution-products__name"><?php echo ( $block[ 'test-1-1-1' ] ) ?></span>
<?php
break;
}
case 'test-2' : {
?>
<span class="solution-products__name"><?php echo ( $block[ 'test-2-1' ] ) ?></span>
<?php foreach ($block['test-2'] as $blocktwo): ?>
<?php switch( $blocktwo[ '_type'] ) {
case 'test-3' : {
?>
<span class="solution-products__name"><?php echo ( $block[ 'test-3-1-1' ] ) ?></span>
<?php
break;
}}?>
<?php endforeach; ?>
<?php
break;
}}
?>
<?php endforeach; ?>
<?php endif; ?>
<pre>array (
)</pre>
Field::make( 'complex', 'test-1', 'Галерея фотографий' )
->add_fields( 'test-1-1', 'галерея', array(
Field::make( 'text', 'test-1-1-1', 'Название раздела' ),
Field::make('complex', 'test-2', 'Свойства товара')
->add_fields( array(
Field::make('text', 'test-2-1-1', 'Свойство'),
))
))
<?php foreach ($block['test-2'] as $blocktwo): ?>
<?php echo '<pre>' . var_export($blocktwo, true) . '</pre>'; ?>
<span class="solution-products__name"><?php echo ( $blocktwo[ 'test-2-1-1' ] ) ?></span>
<?php endforeach; ?>
<?php $blocks = carbon_get_post_meta( get_the_id(), 'test-1'); ?>
<?php if (!empty($blocks)): ?>
<?php foreach ($blocks as $block): ?>
<?php switch( $block[ '_type'] ) {
case 'test-1-1' : {
?>
<span class="solution-products__name"><?php echo ( $block[ 'test-1-1-1' ] ) ?></span>
<?php echo '<pre>' . var_export($blocks, true) . '</pre>'; ?>
<?php foreach ($block['test-2'] as $blocktwo): ?>
<?php echo '<pre>' . var_export($blocktwo, true) . '</pre>'; ?>
<span class="solution-products__name"><?php echo ( $blocktwo[ 'test-2-1-1' ] ) ?></span>
<?php endforeach; ?>
<?php
break;
} }
?>
<?php endforeach; ?>
<?php endif; ?>
<pre>array (
0 =>
array (
'_type' => 'test-1-1',
'test-1-1-1' => 'Название раздела №1',
'test-2' =>
array (
),
),
1 =>
array (
'_type' => 'test-1-1',
'test-1-1-1' => 'Название раздела №2',
'test-2' =>
array (
),
),
)</pre>