我在Wordpress中创建页面,显示与页面标题相同标签的所有帖子(例如,名为'dog'的页面的所有'狗'帖子。目标是能够快速创建分类页面。如何让图像在Wordpress模板中显示循环?
我有波纹管成功的代码显示标题和后期的文字,但我想也显示每个职位的图像(如果该帖子有任何图像)。2个问题...
- 如何每个帖子用wordpress显示一个图像?
- 如何在循环中实现上面的文字?
<?php
/**
* Template Name: Category Page Template
* Description: A Page Template for Categories
*/
get_header(); ?>
<div id="primary">
<div id="content" role="main">
<?php $catname = wp_title('', false); ?>
<?php query_posts("category_name=$catname&showposts=3"); ?>
<?php $posts = get_posts("category_name=$catname&numberposts=3&offset=0");
foreach ($posts as $post) : include(loop.php);?>
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php endforeach; ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>