你好我正在使用来自https://github.com/tammyhart/Reusable-Custom-WordPress-Meta-Boxes的可重用自定义元变量.. 这些是我的领域
array(
'label' => __('Setup Slider', 'crispy' ),
'desc' => __('create your slider image/ text using these repeatable options', 'crispy' ),
'id' => $prefix.'repeatable',
'type' => 'repeatable',
'sanitizer' => array(
'title' => 'sanitize_text_field',
'desc' => 'wp_kses_data'
),
'repeatable_fields' => array (
array(
'label' => __(' Slider Text alignment', 'crispy'),
'id' => 'alignment',
'type' => 'radio',
'options' => array (
'one' => array (
'label' => __('Left', 'crispy' ),
'value' => 'left'
),
'two' => array (
'label' => __('Center', 'crispy' ),
'value' => 'center'
),
'three' => array (
'label' => __('Right', 'crispy' ),
'value' => 'right'
)
)
),
array(
'label' => __('Background Image/pattern', 'crispy' ),
'id' => 'image',
'type' => 'image'
),
array(
'label' => __('Title', 'crispy' ),
'id' => 'title',
'type' => 'text'
),
array(
'label' => __('Description', 'crispy' ),
'id' => 'desc',
'type' => 'textarea'
),
)
),
我的问题是我不知道如何存储字段值......任何人都可以解决我的问题!! ..
$home_slider_alignment = get_post_meta( $post->ID, 'alignment', true);
我使用了这个,但没有帮助!! ..那些字段可以重复,所以值存储在数组!! !!我不知道如何从该数组中检索存储的值? ..
请帮帮我!!
答案 0 :(得分:0)
它正在工作:)
enter code here
<?php
$projectgallery = get_post_meta($post->ID, 'arcadia_well_projectgallery', true); {
echo '<ul class="custom_repeatable">';
foreach ($projectgallery as $project) {
echo '<li>';
foreach($project as $i=>$value) {
echo $value;
}
echo '</li>';
}
echo '</ul>';
}
?>