编辑“WordPress:Displaying Posts Using a Custom Select Query”
该编辑可以被撤销。 请检查下面的对比以核实您想要撤销的内容,然后发布下面的更改以完成撤销。
最后版本 | 您的文本 | ||
第46行: | 第46行: | ||
现在,若要通过以前的[[WordPress:Wikipedia:SELECT|SELECT]] 标准来显示<tt>$pageposts</tt>中的文章,你需要用Qbased网页模板中你自己的循环编码来替代[[WordPress:The Loop]]。这需要创建一个已修改的循环(loop),使它能够循环<tt>$pageposts</tt>中的文章并显示它们。注意:下面loop(循环)中的结构/标记取自WordPress“默认”[[WordPress:Using Themes|主题]]. | 现在,若要通过以前的[[WordPress:Wikipedia:SELECT|SELECT]] 标准来显示<tt>$pageposts</tt>中的文章,你需要用Qbased网页模板中你自己的循环编码来替代[[WordPress:The Loop]]。这需要创建一个已修改的循环(loop),使它能够循环<tt>$pageposts</tt>中的文章并显示它们。注意:下面loop(循环)中的结构/标记取自WordPress“默认”[[WordPress:Using Themes|主题]]. | ||
。 | 。 | ||
<pre> | |||
<?php if ($pageposts): ?> | |||
<?php foreach ($pageposts as $post): ?> | |||
<?php setup_postdata($post); ?> | |||
<div class="post" id="post-<?php the_ID(); ?>"> | |||
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"> | |||
<?php the_title(); ?></a></h2> | |||
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> | |||
<div class="entry"> | |||
<?php the_content('Read the rest of this entry »'); ?> | |||
</div> | |||
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> | |||
<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p> | |||
</div> | |||
<?php endforeach; ?> | |||
<?php else : ?> | |||
<h2 class="center">Not Found</h2> | |||
<p class="center">Sorry, but you are looking for something that isn't here.</p> | |||
<?php include (TEMPLATEPATH . "/searchform.php"); ?> | |||
<?php endif; ?> | |||
</pre> | |||
<pre> | <pre> | ||
<?php if ($pageposts): ?> | <?php if ($pageposts): ?> | ||
第78行: | 第101行: | ||
<?php if ($pageposts): ?> | <?php if ($pageposts): ?> | ||
</pre> | </pre> | ||
* A [[WordPress:Wikipedia:Foreach|foreach loop]] to go through the posts returned in <tt>$pageposts</tt> and display them: | |||
<pre> | |||
<?php foreach($pageposts as $post): ?> | |||
</pre> | |||
<pre> | |||
<?php if ($pageposts): ?> | |||
</pre> | |||
* A [[WordPress:Wikipedia:Foreach|foreach loop]] to go through the posts returned in <tt>$pageposts</tt> and display them: | |||
*[[WordPress:Wikipedia:Foreach|foreach loop]]审查已返回<tt>$pageposts</tt>的文章,并显示文章: | *[[WordPress:Wikipedia:Foreach|foreach loop]]审查已返回<tt>$pageposts</tt>的文章,并显示文章: | ||
<pre> | <pre> |