0
设置一个页面作为我的帖子的索引后,rwmb_meta
已停止工作在此页面上。WordPress的 - rwmb_meta不工作的帖子页面
我的代码:
<?php
$images = rwmb_meta('angel_imgadv', 'type=image&size=full');
var_dump($images);
?>
结果:
array(0) {
}
但我必须连接到该页面已影像:
我的设置:
add_filter('rwmb_meta_boxes', 'angel_register_meta_boxes');
/**
* Register meta boxes
*
* Remember to change "your_prefix" to actual prefix in your project
*
* @param array $meta_boxes List of meta boxes
*
* @return array
*/
function angel_register_meta_boxes($meta_boxes)
{
/**
* prefix of meta keys (optional)
* Use underscore (_) at the beginning to make keys hidden
* Alt.: You also can make prefix empty to disable it
*/
// Better has an underscore as last sign
$prefix = 'angel_';
// 2nd meta box
$meta_boxes[] = array(
'title' => __('Advanced Images', 'angel_'),
'post_types' => array('post', 'page'),
'fields' => array(
array(
'name' => __('Carousal', 'angel_'),
'id' => "{$prefix}imgadv",
'type' => 'image_advanced',
'max_file_uploads' => 10,
),
// DIVIDER
array(
'type' => 'divider',
'id' => 'fake_divider_id', // Not used, but needed
),
// IMAGE ADVANCED (WP 3.5+)
array(
'name' => __('Cover Images', 'angel_'),
'id' => "{$prefix}imgcover",
'type' => 'image_advanced',
'max_file_uploads' => 2,
),
// DIVIDER
array(
'type' => 'divider',
'id' => 'fake_divider_id', // Not used, but needed
),
// IMAGE ADVANCED (WP 3.5+)
array(
'name' => __('Lightbox Images', 'angel_'),
'id' => "{$prefix}imglightbox",
'type' => 'image_advanced',
// 'max_file_uploads' => 10,
),
),
);
// Get post/page ID.
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
return $meta_boxes;
}
任何想法?我正在使用的是metabox plugin。