Php Wordpress在post中不显示图像

Php Wordpress在post中不显示图像,php,wordpress,image,custom-fields,Php,Wordpress,Image,Custom Fields,我有自定义字段(单个图像)。 我返回对象图像。 我的代码是: $post_single_image = get_post_field( 'single_image', $post_id ); <?php if($post_single_image!=''): ?> <div class="art-image-sing" > <?php echo do_shortcode($post_single_image); ?> </div> $

我有自定义字段(单个图像)。 我返回对象图像。 我的代码是:

$post_single_image = get_post_field( 'single_image', $post_id );
<?php if($post_single_image!=''): ?>
<div class="art-image-sing" >
     <?php echo do_shortcode($post_single_image); ?> 
</div>
$post\u single\u image=get\u post\u字段('single\u image',$post\u id);
但是wp返回我的id图像。 我试图更改url图像,但wp返回id图像


除了图像id之外,我如何获取其他信息?

您必须像这样使用代码

$post_single_image = get_post_field( 'single_image', $post_id );
<?php if($post_single_image!=''): ?>
<div class="art-image-sing" >
     <?php echo do_shortcode([$post_single_image]); ?> 
</div>
$post\u single\u image=get\u post\u字段('single\u image',$post\u id);

必须在“管理”面板的“自定义”字段中的“do_短代码”([$post_single_image])中提及do_短代码。自定义字段“single_image”的类型为“image Object”,但它不会将图像作为对象返回,而是返回图像的id。然后,您需要添加一个函数,使id吐出图像!!thx,这是一条出路。用法:wp_get_attachment_image()