我正在使用以下代码将随机发布数据拖放到我的博客的侧栏上。我将如何添加从该帖子的自定义字段“athletethumbnail”中拉出的图像? :从Wordpress帖子的自定义字段中显示图像
<?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();
?>
在哪里可以放置数组? – Sam
你有可能为我发布完整的代码吗?我似乎无法得到它的工作 – Sam
让我知道,如果这有帮助吗? –