我試圖用我創建的插件顯示一些文章縮略圖,但是當我將代碼添加到頁面時,它會在頁面開始之前顯示縮略圖我擁有的東西。我不知道那是爲什麼。顯示在頁面開頭的Wordpress post_thumbnail
該插件:
<?php
add_image_size('cortar', 250, 250, true); // Hard Crop Mode
function wpb_recent_post() {
$the_query = new WP_Query('showposts=1&cat=25');
while ($the_query -> have_posts()) : $the_query -> the_post();
$src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), cortar, false, '');?>
<img src="<?php echo $src[0];?>" />
<?php endwhile;
}
add_shortcode('posts_recientes', 'wpb_recent_post');
?>
頁面的內容:
<h3>Poesia</h3>
[three_columns]
[column1]
<h4>This is a heading</h4>
[posts_recientes]
[/column1]
[column2]
<h4>This is a heading</h4>
[posts_recientes]
[/column2]
[column3]
<h4>This is a heading</h4>
[posts_recientes]
[/column3]
[/three_columns]
它顯示方式:
http://www.ixmapp.com/circulodepoesia/prueba/
應該縮略圖之前顯示的標題。
任何幫助將非常感激。