我正在使用以下代码将随机发布数据拉到我博客的侧边栏。我将如何添加从该帖子的自定义字段“athletethumbnail”中提取的图像?:
<?php
global $wp_query;
$current_id = $wp_query->get_queried_object_id();
$my_query = new WP_Query( array(
'post_type'=>'athletes',
'posts_per_page'=>'1',
'category' => '36' ,
'orderby' =>'rand'
));
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post();
?>
<?php the_title(); ?>
<?php
endwhile;
}
wp_reset_query();
?>