我的主页顶部有这些磁贴元素:
<div id="tile-holder" class="group">
<div class="tile1">
<div class="tile-textbox" style="color: #22284f;">Just Some Title</div>
</div>
<div class="tile2">
<img class="post-image" src="images/sample-large-2.jpg"/>
<div class="tile-datebox">
<img src="images/video-icon.png" >
<p>2013/2/25</p>
<div class="tile-info"><h1><a href="index2.html">Title 1</a></h1></div>
</div>
</div>
<div class="tile3">
<img class="post-image" src="images/sample-mid-2.jpg"/>
<div class="tile-datebox">
<img src="images/image-icon.png" >
<p>2013/5/15</p>
<div class="tile-info"><h1>Title 2</h1></div>
</div>
</div>
<div class="tile4">
<img class="post-image" src="images/sample-mid-3.jpg"/>
<div class="tile-datebox">
<img src="images/text-icon.png" >
<p>2013/6/17</p>
<div class="tile-info"><h1>Title 3</h1></div>
</div>
</div>
<div class="tile5">
<div class="tile-textbox" style="color: #ffffff;">Another Title</div>
</div>
</div> <!-- END Tile Holder -->
我想在图块 2、3 和 4 中显示 3 个最新帖子;只是从我定义的自定义字段中获取 url 的标题、日期和图像,我尝试使用:
.
.
.
<?php query_posts("post_per_page=3"); the_post(); ?>
<div class="tile2">
<img class="post-image" src="<?php echo get_post_meta($post->ID, 'post_image', true) ?>"/>
<div class="tile-datebox">
<img src="<?php echo get_post_meta($post->ID, 'post_icon', true) ?>" >
<p><?php the_time('F jS, Y') ?></p>
<div class="tile-info"><h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1></div>
</div>
</div>
<div class="tile3">
<img class="post-image" src="<?php echo get_post_meta($post->ID, 'post_image', true) ?>"/>
<div class="tile-datebox">
<img src="<?php echo get_post_meta($post->ID, 'post_icon', true) ?>" >
<p><?php the_time('F jS, Y') ?></p>
<div class="tile-info"><h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1></div>
</div>
</div>
<div class="tile4">
<img class="post-image" src="<?php echo get_post_meta($post->ID, 'post_image', true) ?>"/>
<div class="tile-datebox">
<img src="<?php echo get_post_meta($post->ID, 'post_icon', true) ?>" >
<p><?php the_time('F jS, Y') ?></p>
<div class="tile-info"><h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1></div>
</div>
</div>
<?php wp_reset_query(); ?>
.
.
.
但它只是得到一个帖子并在那里显示,有什么问题?我错过了什么?请帮忙,我是wordpress世界的新手!