我如何才能在WordPress中像這裏一樣顯示帖子的縮略圖和標題:http://themes.premiumpixels.com/?theme=artiste如何僅在WordPress中顯示帖子的縮略圖和標題?
p.S.我沒有做廣告,我只是發佈了一個問題,因爲我不知道如何做這樣的事情。
我如何才能在WordPress中像這裏一樣顯示帖子的縮略圖和標題:http://themes.premiumpixels.com/?theme=artiste如何僅在WordPress中顯示帖子的縮略圖和標題?
p.S.我沒有做廣告,我只是發佈了一個問題,因爲我不知道如何做這樣的事情。
//從你的循環只是刪除the_content()或the_excerpt()調用
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<!-- do stuff ... -->
if (has_post_thumbnail()) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail();
}
post_title();// to display the post title
<?php endwhile; ?>
<?php endif; ?>
你需要對圖像做:
http://www.wpbeginner.com/wp-themes/how-to-add-post-thumbnails-in-wordpress/
而你需要做的爲小文本:
在function.php中加入:
add_post_type_support('page', 'excerpt');
然後在模板中添加此您post_thumbnail下面的鏈接證明你:
<?php the_exceprt(); ?>
不認爲是什麼他問。 – 2012-02-05 01:21:51
沒有他只是想顯示帖子縮略圖和標題...如果我沒有錯你所提供的sol會顯示文本摘錄形式的帖子(我認爲這將是40個字符的默認) – tinyhook 2012-02-05 18:42:00
我可能是錯誤的,但根據那鏈接不只是一個標題,但一些額外的小信息連同它 – 2012-02-05 19:29:16