Wordpress查询“添加两个帖子”;“入职后”;分区,其中一个带“1”;“张贴缩略图”;还有一个没有
嗨,我叫安东尼,这是我的第一个问题。我现在正在制作一个worpress主题。在循环中,我想有两个“post entry”div,一个很小,靠近我的post拇指,另一个没有拇指 我知道我需要做一件事Wordpress查询“添加两个帖子”;“入职后”;分区,其中一个带“1”;“张贴缩略图”;还有一个没有,wordpress,loops,thumbnails,wordpress-theming,Wordpress,Loops,Thumbnails,Wordpress Theming,嗨,我叫安东尼,这是我的第一个问题。我现在正在制作一个worpress主题。在循环中,我想有两个“post entry”div,一个很小,靠近我的post拇指,另一个没有拇指 我知道我需要做一件事 <div class="post"> <?php if ( has_post_thumbnail()) { ?><div class="post-thumb"> <?php the_post_thumbnail(); ?> </div>
<div class="post">
<?php if ( has_post_thumbnail()) { ?><div class="post-thumb"> <?php the_post_thumbnail(); ?> </div> <div class="post-entry-1"> <? } else { ?><div class="post-entry-2"> <?php } ?>
任何帮助都将不胜感激,因为我已经在这方面坚持了几天了。以下是可用于放置在循环中的模板标记供参考: 听起来你需要使用 _摘录(): 和内容() 也许您需要查看循环:
<!-- Start the Loop. -->
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<!-- The following tests if the current post is in category 3. -->
<!-- If it is, the div box is given the CSS class "post-cat-three". -->
<!-- Otherwise, the div box will be given the CSS class "post". -->
<?php if ( in_category('3') ) { ?>
<div class="post-cat-three">
<?php } else { ?>
<div class="post">
<?php } ?>
<!-- Display the Title as a link to the Post's permalink. -->
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. -->
<small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>
<!-- Display the Post's Content in a div box. -->
<div class="entry">
<?php the_content(); ?>
</div>
<!-- Display a comma separated list of the Post's Categories. -->
<p class="postmetadata">Posted in <?php the_category(', '); ?></p>
</div> <!-- closes the first div box -->
<!-- Stop The Loop (but note the "else:" - see next line). -->
<?php endwhile; else: ?>
<!-- The very first "if" tested to see if there were any Posts to -->
<!-- display. This "else" part tells what do if there weren't any. -->
<p>Sorry, no posts matched your criteria.</p>
<!-- REALLY stop The Loop. -->
<?php endif; ?>
通过
抱歉,没有符合您标准的帖子
这对于StackExchange的新测试版网站来说是一个很好的问题。嗨,Chris_O谢谢你的评论和建议,我将在那里添加:)谢谢Todd,是的,我正在使用_摘录()。我确实把它放在了帖子里,但它显然没有显示出来:我编辑它是为了显示一个循环示例,它应该为您指出正确的方向。多亏了Todd,我成功地解决了这个问题。但在帮助下,我发现我有一个多余的,不需要在那里。一旦被删除,它又能正常工作了。谢谢你的帮助,托德!