Php Wordpress-rwmb_meta无法在帖子页面上工作

Php Wordpress-rwmb_meta无法在帖子页面上工作,php,wordpress,meta-boxes,Php,Wordpress,Meta Boxes,将页面设置为我的帖子的索引后,rwmb\u meta已停止处理此页面 我的代码: <?php $images = rwmb_meta( 'angel_imgadv', 'type=image&size=full'); var_dump($images); ?> 但我已经将图片附在该页面上: 我的设置: add_filter( 'rwmb_meta_boxes', 'angel_register_meta_boxes' ); /** * Register meta

将页面设置为我的帖子的索引后,
rwmb\u meta
已停止处理此页面

我的代码:

<?php
$images = rwmb_meta( 'angel_imgadv', 'type=image&size=full');
var_dump($images);
?>
但我已经将图片附在该页面上:

我的设置:

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;
}
有什么想法吗


这是我正在使用的代码。

您应该使用如下代码并在index.php文件中发布:

<?php 
    global $wp_query;
    $images = rwmb_meta( 'angel_imgadv', 'type=image_advanced&size=full', $wp_query->get_queried_object_id() );
    foreach ( $images as $image ) {
        echo "<img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$image['alt']}' />";
    }
?>

<?php 
    global $wp_query;
    $images = rwmb_meta( 'angel_imgadv', 'type=image_advanced&size=full', $wp_query->get_queried_object_id() );
    foreach ( $images as $image ) {
        echo "<img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$image['alt']}' />";
    }
?>