http://kktzf.com.cn/wiki/history/WordPress:Displaying_Posts_Using_a_Custom_Select_Query?feed=atom 精品久久久bbbb人妻,精品国产自在久久现线拍 2025-07-05T14:42:59Z 本wiki上該頁面的版本歷史 MediaWiki 1.39.3 http://kktzf.com.cn/wiki/WordPress:Displaying_Posts_Using_a_Custom_Select_Query?diff=13411&oldid=prev Xxf3325:?/* 已修改的Loop(循環(huán)) */ 2008-10-17T07:45:22Z <p><span dir="auto"><span class="autocomment">已修改的Loop(循環(huán))</span></span></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="zh-Hans-CN"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">←上一版本</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">2008年10月17日 (五) 15:45的版本</td> </tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l75">第75行:</td> <td colspan="2" class="diff-lineno">第75行:</td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*測試以確保&lt;tt&gt;$pageposts&lt;/tt&gt;中的查詢可以查到符合[[WordPress:Wikipedia:SELECT|SELECT]]標(biāo)準(zhǔn)的文章:</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*測試以確保&lt;tt&gt;$pageposts&lt;/tt&gt;中的查詢可以查到符合[[WordPress:Wikipedia:SELECT|SELECT]]標(biāo)準(zhǔn)的文章:</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">&lt;pre></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">&lt;?php if ($pageposts): ?></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">&lt;/pre></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">* A [[WordPress:Wikipedia:Foreach|foreach loop]] to go through the posts returned in &lt;tt>$pageposts&lt;/tt> and display them:</del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">&lt;pre></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">&lt;?php foreach($pageposts as $post): ?></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">&lt;/pre></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;?php if ($pageposts): ?&gt;</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;?php if ($pageposts): ?&gt;</div></td></tr> <!-- diff cache key wiki-zz_:diff::1.12:old-13409:rev-13411 --> </table> Xxf3325 http://kktzf.com.cn/wiki/WordPress:Displaying_Posts_Using_a_Custom_Select_Query?diff=13409&oldid=prev Xxf3325:?/* 已修改的Loop(循環(huán)) */ 2008-10-17T07:42:30Z <p><span dir="auto"><span class="autocomment">已修改的Loop(循環(huán))</span></span></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="zh-Hans-CN"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">←上一版本</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">2008年10月17日 (五) 15:42的版本</td> </tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l46">第46行:</td> <td colspan="2" class="diff-lineno">第46行:</td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>現(xiàn)在,若要通過以前的[[WordPress:Wikipedia:SELECT|SELECT]] 標(biāo)準(zhǔn)來顯示&lt;tt&gt;$pageposts&lt;/tt&gt;中的文章,你需要用Qbased網(wǎng)頁模板中你自己的循環(huán)編碼來替代[[WordPress:The Loop]]。這需要創(chuàng)建一個已修改的循環(huán)(loop),使它能夠循環(huán)&lt;tt&gt;$pageposts&lt;/tt&gt;中的文章并顯示它們。注意:下面loop(循環(huán))中的結(jié)構(gòu)/標(biāo)記取自WordPress“默認(rèn)”[[WordPress:Using Themes|主題]].</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>現(xiàn)在,若要通過以前的[[WordPress:Wikipedia:SELECT|SELECT]] 標(biāo)準(zhǔn)來顯示&lt;tt&gt;$pageposts&lt;/tt&gt;中的文章,你需要用Qbased網(wǎng)頁模板中你自己的循環(huán)編碼來替代[[WordPress:The Loop]]。這需要創(chuàng)建一個已修改的循環(huán)(loop),使它能夠循環(huán)&lt;tt&gt;$pageposts&lt;/tt&gt;中的文章并顯示它們。注意:下面loop(循環(huán))中的結(jié)構(gòu)/標(biāo)記取自WordPress“默認(rèn)”[[WordPress:Using Themes|主題]].</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>。</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>。</div></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">&lt;pre></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> &lt;?php if ($pageposts): ?></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> &lt;?php foreach ($pageposts as $post): ?></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> &lt;?php setup_postdata($post); ?></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> </del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> &lt;div class="post" id="post-&lt;?php the_ID(); ?>"></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> &lt;h2>&lt;a href="&lt;?php the_permalink() ?>" rel="bookmark" title="Permanent Link to &lt;?php the_title(); ?>"></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">? ? &lt;?php the_title(); ?>&lt;/a>&lt;/h2></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">? ? &lt;small>&lt;?php the_time('F jS, Y') ?> &lt;!-- by &lt;?php the_author() ?> -->&lt;/small></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">? ? &lt;div class="entry"></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">? ? ? &lt;?php the_content('Read the rest of this entry &amp;raquo;'); ?></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">? ? &lt;/div></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">? ? &lt;p class="postmetadata">Posted in &lt;?php the_category(', ') ?> | &lt;?php edit_post_link('Edit', '', ' | '); ?>? </del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">? ? &lt;?php comments_popup_link('No Comments &amp;#187;', '1 Comment &amp;#187;', '% Comments &amp;#187;'); ?>&lt;/p></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> &lt;/div></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> &lt;?php endforeach; ?></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> &lt;?php else : ?></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">? ? &lt;h2 class="center">Not Found&lt;/h2></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">? ? &lt;p class="center">Sorry, but you are looking for something that isn't here.&lt;/p></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">? ? &lt;?php include (TEMPLATEPATH . "/searchform.php"); ?></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> &lt;?php endif; ?></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">&lt;/pre></del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>? &lt;?php if ($pageposts): ?&gt;</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>? &lt;?php if ($pageposts): ?&gt;</div></td></tr> <!-- diff cache key wiki-zz_:diff::1.12:old-13407:rev-13409 --> </table> Xxf3325 http://kktzf.com.cn/wiki/WordPress:Displaying_Posts_Using_a_Custom_Select_Query?diff=13407&oldid=prev Xxf3325:?/* 已修改的Loop(循環(huán)) */ 2008-10-17T07:41:49Z <p><span dir="auto"><span class="autocomment">已修改的Loop(循環(huán))</span></span></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="zh-Hans-CN"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">←上一版本</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">2008年10月17日 (五) 15:41的版本</td> </tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l108">第108行:</td> <td colspan="2" class="diff-lineno">第108行:</td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;?php if ($pageposts): ?&gt;</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;?php if ($pageposts): ?&gt;</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;/pre&gt;</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;/pre&gt;</div></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">* A [[WordPress:Wikipedia:Foreach|foreach loop]] to go through the posts returned in &lt;tt>$pageposts&lt;/tt> and display them:</del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*[[WordPress:Wikipedia:Foreach|foreach loop]]審查已返回&lt;tt&gt;$pageposts&lt;/tt&gt;的文章,并顯示文章:</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*[[WordPress:Wikipedia:Foreach|foreach loop]]審查已返回&lt;tt&gt;$pageposts&lt;/tt&gt;的文章,并顯示文章:</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td></tr> <!-- diff cache key wiki-zz_:diff::1.12:old-13406:rev-13407 --> </table> Xxf3325 http://kktzf.com.cn/wiki/WordPress:Displaying_Posts_Using_a_Custom_Select_Query?diff=13406&oldid=prev 2008年10月17日 (五) 07:38 Xxf3325 2008-10-17T07:38:16Z <p></p> <a href="http://kktzf.com.cn/wiki/WordPress:Displaying_Posts_Using_a_Custom_Select_Query?diff=13406&amp;oldid=13398">顯示更改</a> Xxf3325 http://kktzf.com.cn/wiki/WordPress:Displaying_Posts_Using_a_Custom_Select_Query?diff=13398&oldid=prev 2008年10月17日 (五) 07:21 Xxf3325 2008-10-17T07:21:52Z <p></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="zh-Hans-CN"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">←上一版本</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">2008年10月17日 (五) 15:21的版本</td> </tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l4">第4行:</td> <td colspan="2" class="diff-lineno">第4行:</td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>以下概述的實例展示了這樣一個過程:選擇有[[WordPress:Using Custom Fields | 定制區(qū)域]]存入值的所有文章并把它們在建立在[[WordPress:Pages#Creating_your_own_Page_Templates|頁面模板]]基礎(chǔ)上的[[WordPress:Pages|頁面]]顯示出來。這些編碼最初用來執(zhí)行文章標(biāo)簽[[WordPress:Plugins|插件]],它允許以比WordPress[[WordPress:Manage_Categories_SubPanel|分類]]稍無序的構(gòu)架來組織文章。你的使用或許有所不同,但以下的例子仍會給你提供些有用的一般過程說明。</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>以下概述的實例展示了這樣一個過程:選擇有[[WordPress:Using Custom Fields | 定制區(qū)域]]存入值的所有文章并把它們在建立在[[WordPress:Pages#Creating_your_own_Page_Templates|頁面模板]]基礎(chǔ)上的[[WordPress:Pages|頁面]]顯示出來。這些編碼最初用來執(zhí)行文章標(biāo)簽[[WordPress:Plugins|插件]],它允許以比WordPress[[WordPress:Manage_Categories_SubPanel|分類]]稍無序的構(gòu)架來組織文章。你的使用或許有所不同,但以下的例子仍會給你提供些有用的一般過程說明。</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">=== Assumptions made in this Article ===</del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>=== 文章假設(shè) ===</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>=== 文章假設(shè) ===</div></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">Generally, this article assumes you have a working knowledge of [[WordPress:Glossary#PHP|PHP]], [[WordPress:Glossary#MySQL|MySQL]], and WordPress capabilities.</del></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>?</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>本文通常假設(shè)你擁有[[WordPress:Glossary#PHP|PHP]], [[WordPress:Glossary#MySQL|MySQL]]知識和WordPress 使用能力。</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>本文通常假設(shè)你擁有[[WordPress:Glossary#PHP|PHP]], [[WordPress:Glossary#MySQL|MySQL]]知識和WordPress 使用能力。</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">Specific assumptions for the example, however, are:</del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>但此例的特定假設(shè)是:</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>但此例的特定假設(shè)是:</div></td></tr> <tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">*你至少擁有一篇[[WordPress:Using Custom Fields |定制區(qū)域]]數(shù)據(jù)文章。自定義區(qū)域有“標(biāo)簽”鍵和“電子郵件”鍵值。</ins></div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">* You have at least one post with [[WordPress:Using Custom Fields | Custom Fields]] data.? The Custom Fields should have a key of 'tag' and a value of 'email'</del></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>*你已創(chuàng)建一個[[WordPress:Pages|<ins style="font-weight: bold; text-decoration: none;">頁面</ins>]]并有一個[[WordPress:Pages#Page_Templates|<ins style="font-weight: bold; text-decoration: none;">頁面模板</ins>]]鏈接。在此例中,假定模板名稱為'Qbased',它是從wp-content/themes/index.php模板復(fù)制的。如果你對此過程不熟悉,按照[[WordPress:Pages#Creating_your_own_Page_Templates|<ins style="font-weight: bold; text-decoration: none;">創(chuàng)建你自己的頁面模板</ins>]]中的說明進(jìn)行操作。</div></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">*你至少擁有一篇[[WordPress:Using Custom Fields | Custom Fields]]數(shù)據(jù)文章。自定義字段有“標(biāo)簽”鍵和“電子郵件”鍵值。</del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>?</div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">* You have created a [[WordPress:Pages|Page]] and associated a [[WordPress:Pages#Page_Templates|Page Template]] with that page.? For this example, assume the Template Name is 'Qbased' and was copied from the ''wp-content/themes/index.php'' template.? If you are not familiar with this process, follow the instructions in [[WordPress:Pages#Creating_your_own_Page_Templates|Creating your own Page Templates]].</del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>*你已創(chuàng)建一個[[WordPress:Pages|<del style="font-weight: bold; text-decoration: none;">Page</del>]]并有一個[[WordPress:Pages#Page_Templates|<del style="font-weight: bold; text-decoration: none;">Page Template</del>]]鏈接。在此例中,假定模板名稱為'Qbased',它是從wp-content/themes/index.php模板復(fù)制的。如果你對此過程不熟悉,按照[[WordPress:Pages#Creating_your_own_Page_Templates|<del style="font-weight: bold; text-decoration: none;">Creating your own Page Templates</del>]]中的說明進(jìn)行操作。</div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">* As this is a somewhat advanced developer topic, familiarity with the core WordPress concept of [[WordPress:The Loop|循環(huán)]] is suggested. </del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*由于這是稍先進(jìn)的開發(fā)主題,推薦掌握[[WordPress:The Loop|循環(huán)]]的WordPress核心概念。</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*由于這是稍先進(jìn)的開發(fā)主題,推薦掌握[[WordPress:The Loop|循環(huán)]]的WordPress核心概念。</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">== Code for the Page Template ==</del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== 網(wǎng)頁模板編碼 ==</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== 網(wǎng)頁模板編碼 ==</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">===The query===</del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>===查詢===</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>===查詢===</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>To begin with, it is necessary to retrieve the [[WordPress:Glossary#Recordset|recordset]] containing the posts you want to display.? To do this, create a result set using the WordPress [[WordPress:Function_Reference/wpdb_Class|$wpdb database class]].? Note that the [[WordPress:Glossary#MySQL|MySQL]] [[WordPress:Wikipedia:SELECT|SELECT]] statement illustrates a '''simple''' [[WordPress:Wikipedia:JOIN|JOIN]].? Here, &lt;tt&gt;$pageposts&lt;/tt&gt; will contain an [[WordPress:Glossary#Array|array]] of objects. Each object will represent a '''published''' post that has custom field key-value pair - with the key being 'tag' and the value being 'email':</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>To begin with, it is necessary to retrieve the [[WordPress:Glossary#Recordset|recordset]] containing the posts you want to display.? To do this, create a result set using the WordPress [[WordPress:Function_Reference/wpdb_Class|$wpdb database class]].? Note that the [[WordPress:Glossary#MySQL|MySQL]] [[WordPress:Wikipedia:SELECT|SELECT]] statement illustrates a '''simple''' [[WordPress:Wikipedia:JOIN|JOIN]].? Here, &lt;tt&gt;$pageposts&lt;/tt&gt; will contain an [[WordPress:Glossary#Array|array]] of objects. Each object will represent a '''published''' post that has custom field key-value pair - with the key being 'tag' and the value being 'email':</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>首先,需要檢索[[WordPress:Glossary#Recordset|<del style="font-weight: bold; text-decoration: none;">recordset</del>]<del style="font-weight: bold; text-decoration: none;">](數(shù)據(jù)集),里面包含你要顯示的文章。要做到這一點,需要使用WordPress</del>[[WordPress:Function_Reference/wpdb_Class|$wpdb <del style="font-weight: bold; text-decoration: none;">database class</del>]]<del style="font-weight: bold; text-decoration: none;">創(chuàng)建一個result set(結(jié)果集)。注意</del>[[WordPress:Glossary#MySQL|MySQL]] [[WordPress:Wikipedia:SELECT|SELECT]]指令闡明了一個“簡單的” [[WordPress:Wikipedia:JOIN|JOIN]]。&lt;tt&gt;$pageposts&lt;/tt&gt;在此會包含[[WordPress:Glossary#Array|<del style="font-weight: bold; text-decoration: none;">array</del>]]對象。每個對象代表一篇有自定義字段key-value(鍵-鍵值)配對且鍵名為tag,值為email的“已發(fā)布”文章。</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>首先,需要檢索[[WordPress:Glossary#Recordset|<ins style="font-weight: bold; text-decoration: none;">數(shù)據(jù)集</ins>]<ins style="font-weight: bold; text-decoration: none;">,里面包含你要顯示的文章。要做到這一點,需要使用WordPress</ins>[[WordPress:Function_Reference/wpdb_Class|$wpdb <ins style="font-weight: bold; text-decoration: none;">數(shù)據(jù)庫 類</ins>]]<ins style="font-weight: bold; text-decoration: none;">創(chuàng)建一個(結(jié)果集)。注意</ins>[[WordPress:Glossary#MySQL|MySQL]] [[WordPress:Wikipedia:SELECT|SELECT]]指令闡明了一個“簡單的” [[WordPress:Wikipedia:JOIN|JOIN]]。&lt;tt&gt;$pageposts&lt;/tt&gt;在此會包含[[WordPress:Glossary#Array|<ins style="font-weight: bold; text-decoration: none;">數(shù)組</ins>]]對象。每個對象代表一篇有自定義字段key-value(鍵-鍵值)配對且鍵名為tag,值為email的“已發(fā)布”文章。</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td></tr> <!-- diff cache key wiki-zz_:diff::1.12:old-13394:rev-13398 --> </table> Xxf3325 http://kktzf.com.cn/wiki/WordPress:Displaying_Posts_Using_a_Custom_Select_Query?diff=13394&oldid=prev 2008年10月17日 (五) 06:51 Xxf3325 2008-10-17T06:51:43Z <p></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="zh-Hans-CN"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">←上一版本</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">2008年10月17日 (五) 14:51的版本</td> </tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l19">第19行:</td> <td colspan="2" class="diff-lineno">第19行:</td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* As this is a somewhat advanced developer topic, familiarity with the core WordPress concept of [[WordPress:The Loop|循環(huán)]] is suggested. ?</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* As this is a somewhat advanced developer topic, familiarity with the core WordPress concept of [[WordPress:The Loop|循環(huán)]] is suggested. ?</div></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>*由于這是稍先進(jìn)的開發(fā)主題,推薦掌握[[WordPress:The Loop]]的WordPress核心概念。</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>*由于這是稍先進(jìn)的開發(fā)主題,推薦掌握[[WordPress:The Loop<ins style="font-weight: bold; text-decoration: none;">|循環(huán)</ins>]]的WordPress核心概念。</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Code for the Page Template ==</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Code for the Page Template ==</div></td></tr> <!-- diff cache key wiki-zz_:diff::1.12:old-13393:rev-13394 --> </table> Xxf3325 http://kktzf.com.cn/wiki/WordPress:Displaying_Posts_Using_a_Custom_Select_Query?diff=13393&oldid=prev 2008年10月17日 (五) 06:50 Xxf3325 2008-10-17T06:50:47Z <p></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="zh-Hans-CN"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">←上一版本</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">2008年10月17日 (五) 14:50的版本</td> </tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l18">第18行:</td> <td colspan="2" class="diff-lineno">第18行:</td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*你已創(chuàng)建一個[[WordPress:Pages|Page]]并有一個[[WordPress:Pages#Page_Templates|Page Template]]鏈接。在此例中,假定模板名稱為'Qbased',它是從wp-content/themes/index.php模板復(fù)制的。如果你對此過程不熟悉,按照[[WordPress:Pages#Creating_your_own_Page_Templates|Creating your own Page Templates]]中的說明進(jìn)行操作。</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*你已創(chuàng)建一個[[WordPress:Pages|Page]]并有一個[[WordPress:Pages#Page_Templates|Page Template]]鏈接。在此例中,假定模板名稱為'Qbased',它是從wp-content/themes/index.php模板復(fù)制的。如果你對此過程不熟悉,按照[[WordPress:Pages#Creating_your_own_Page_Templates|Creating your own Page Templates]]中的說明進(jìn)行操作。</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* As this is a somewhat advanced developer topic, familiarity with the core WordPress concept of [[WordPress:The Loop]] is suggested. ?</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* As this is a somewhat advanced developer topic, familiarity with the core WordPress concept of [[WordPress:The Loop<ins style="font-weight: bold; text-decoration: none;">|循環(huán)</ins>]] is suggested. ?</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*由于這是稍先進(jìn)的開發(fā)主題,推薦掌握[[WordPress:The Loop]]的WordPress核心概念。</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*由于這是稍先進(jìn)的開發(fā)主題,推薦掌握[[WordPress:The Loop]]的WordPress核心概念。</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <!-- diff cache key wiki-zz_:diff::1.12:old-13309:rev-13393 --> </table> Xxf3325 http://kktzf.com.cn/wiki/WordPress:Displaying_Posts_Using_a_Custom_Select_Query?diff=13309&oldid=prev 2008年10月16日 (四) 09:51 Xxf3325 2008-10-16T09:51:05Z <p></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="zh-Hans-CN"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">←上一版本</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">2008年10月16日 (四) 17:51的版本</td> </tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1">第1行:</td> <td colspan="2" class="diff-lineno">第1行:</td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">== Description ==</del></div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== 描述 ==</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== 描述 ==</div></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">At some point in your WordPress development career you may be presented with the need to display one or more posts using [[WordPress:Wikipedia:SELECT|SELECT]] criteria not provided by WordPress' [[WordPress:Template Tags/query posts | query_posts]] architecture.? For instance, it may become necessary to [[WordPress:Wikipedia:JOIN|JOIN]] WordPress tables to determine which posts should be displayed, or you may want to use data stored in your own tables to determine which [[WordPress:Writing Posts|posts]] should be displayed.</del></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>在你的WordPress發(fā)展歷程的某個時刻,或許你需要通過非WordPress的[[WordPress:Template Tags/query posts | query_posts]] 架構(gòu)提供的[[WordPress:Wikipedia:SELECT|<ins style="font-weight: bold; text-decoration: none;">選擇</ins>]]標(biāo)準(zhǔn)來顯示一篇或更多的文章。例如,你有時或許必須[[WordPress:Wikipedia:JOIN|<ins style="font-weight: bold; text-decoration: none;">加入</ins>]] <ins style="font-weight: bold; text-decoration: none;">WordPress表格以確定要顯示的文章或使用自己表格中的儲存數(shù)據(jù)來確定要顯示</ins>[[WordPress:Writing Posts|<ins style="font-weight: bold; text-decoration: none;">正在寫的文章</ins>]]。</div></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>在你的WordPress發(fā)展歷程的某個時刻,或許你需要通過非WordPress的[[WordPress:Template Tags/query posts | query_posts]] 架構(gòu)提供的[[WordPress:Wikipedia:SELECT|<del style="font-weight: bold; text-decoration: none;">SELECT</del>]]標(biāo)準(zhǔn)來顯示一篇或更多的文章。例如,你有時或許必須[[WordPress:Wikipedia:JOIN|<del style="font-weight: bold; text-decoration: none;">JOIN</del>]] <del style="font-weight: bold; text-decoration: none;">WordPress表格以確定要顯示的文章或使用自己表格中的儲存數(shù)據(jù)來確定要顯示的</del>[[WordPress:Writing Posts|<del style="font-weight: bold; text-decoration: none;">posts</del>]]。</div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">The practical example, outlined below, demonstrates a process of selecting all posts with a particular [[WordPress:Using Custom Fields | Custom Field]] value stored, and displaying them in a [[WordPress:Pages|Page]] based on a [[WordPress:Pages#Creating_your_own_Page_Templates|Page Template]]. Originally, this code was used to implement a post tagging [[WordPress:Plugins|plugin]], which allowed organizing posts in less structured collections than the WordPress [[WordPress:Manage_Categories_SubPanel|Categories]]. Your own usage may be very different, but the content and example should still give you a useful introduction to the general process involved.</del></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>以下概述的實例展示了這樣一個過程:選擇有[[WordPress:Using Custom Fields | <ins style="font-weight: bold; text-decoration: none;">定制區(qū)域</ins>]]存入值的所有文章并把它們在建立在[[WordPress:Pages#Creating_your_own_Page_Templates|<ins style="font-weight: bold; text-decoration: none;">頁面模板</ins>]]基礎(chǔ)上的[[WordPress:Pages|<ins style="font-weight: bold; text-decoration: none;">頁面</ins>]]顯示出來。這些編碼最初用來執(zhí)行文章標(biāo)簽[[WordPress:Plugins|<ins style="font-weight: bold; text-decoration: none;">插件</ins>]],它允許以比WordPress[[WordPress:Manage_Categories_SubPanel|<ins style="font-weight: bold; text-decoration: none;">分類</ins>]]稍無序的構(gòu)架來組織文章。你的使用或許有所不同,但以下的例子仍會給你提供些有用的一般過程說明。</div></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>以下概述的實例展示了這樣一個過程:選擇有[[WordPress:Using Custom Fields | <del style="font-weight: bold; text-decoration: none;">Custom Field</del>]]存入值的所有文章并把它們在建立在[[WordPress:Pages#Creating_your_own_Page_Templates|<del style="font-weight: bold; text-decoration: none;">Page Template</del>]]基礎(chǔ)上的[[WordPress:Pages|<del style="font-weight: bold; text-decoration: none;">Page</del>]]顯示出來。這些編碼最初用來執(zhí)行文章標(biāo)簽[[WordPress:Plugins|<del style="font-weight: bold; text-decoration: none;">plugin</del>]],它允許以比WordPress[[WordPress:Manage_Categories_SubPanel|<del style="font-weight: bold; text-decoration: none;">Categories</del>]]稍無序的構(gòu)架來組織文章。你的使用或許有所不同,但以下的例子仍會給你提供些有用的一般過程說明。</div></td><td colspan="2" class="diff-side-added"></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>=== Assumptions made in this Article ===</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>=== Assumptions made in this Article ===</div></td></tr> <!-- diff cache key wiki-zz_:diff::1.12:old-13211:rev-13309 --> </table> Xxf3325 http://kktzf.com.cn/wiki/WordPress:Displaying_Posts_Using_a_Custom_Select_Query?diff=13211&oldid=prev 2008年10月16日 (四) 07:30 Doreen 2008-10-16T07:30:44Z <p></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="zh-Hans-CN"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">←上一版本</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">2008年10月16日 (四) 15:30的版本</td> </tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l134">第134行:</td> <td colspan="2" class="diff-lineno">第134行:</td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* A test to make sure that the query that populated &lt;tt&gt;$pageposts&lt;/tt&gt; actually found some posts that matched the [[WordPress:Wikipedia:SELECT|SELECT]] criteria:</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* A test to make sure that the query that populated &lt;tt&gt;$pageposts&lt;/tt&gt; actually found some posts that matched the [[WordPress:Wikipedia:SELECT|SELECT]] criteria:</div></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>*測試以確保&lt;tt&gt;$pageposts&lt;/tt&gt;中的查詢可以查到符合[[WordPress:Wikipedia:SELECT|SELECT]]<del style="font-weight: bold; text-decoration: none;">標(biāo)準(zhǔn)中的文章:</del></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>*測試以確保&lt;tt&gt;$pageposts&lt;/tt&gt;中的查詢可以查到符合[[WordPress:Wikipedia:SELECT|SELECT]]<ins style="font-weight: bold; text-decoration: none;">標(biāo)準(zhǔn)的文章:</ins></div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td></tr> <!-- diff cache key wiki-zz_:diff::1.12:old-13208:rev-13211 --> </table> Doreen http://kktzf.com.cn/wiki/WordPress:Displaying_Posts_Using_a_Custom_Select_Query?diff=13208&oldid=prev 2008年10月16日 (四) 07:24 Doreen 2008-10-16T07:24:19Z <p></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="zh-Hans-CN"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">←上一版本</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">2008年10月16日 (四) 15:24的版本</td> </tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l294">第294行:</td> <td colspan="2" class="diff-lineno">第294行:</td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>It is important to note here that the above example will work '''only''' when OBJECT is passed as the &quot;output_type&quot; parameter for &lt;code&gt;$wpdb-&gt;get_results()&lt;/code&gt;. setup_postdata() does not seem to work when ARRAY_A or ARRAY_N is passed in $wpdb-&gt;get_results().</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>It is important to note here that the above example will work '''only''' when OBJECT is passed as the &quot;output_type&quot; parameter for &lt;code&gt;$wpdb-&gt;get_results()&lt;/code&gt;. setup_postdata() does not seem to work when ARRAY_A or ARRAY_N is passed in $wpdb-&gt;get_results().</div></td></tr> <tr><td class="diff-marker" data-marker="?"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">這里值得注意的是上述例子“只有”在對象通過的是</del>&lt;code&gt;$wpdb-&gt;get_results()&lt;/code&gt;<del style="font-weight: bold; text-decoration: none;">的</del>&quot;output_type&quot;<del style="font-weight: bold; text-decoration: none;">參數(shù)時才運行。當(dāng)ARRAY_A </del>或ARRAY_N在$wpdb-&gt;get_results()通過時,setup_postdata()似乎不運行。</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">這里值得注意的是,上述例子“只有”當(dāng)</ins>&lt;code&gt;$wpdb-&gt;get_results()&lt;/code&gt;<ins style="font-weight: bold; text-decoration: none;">是以</ins>&quot;output_type&quot;<ins style="font-weight: bold; text-decoration: none;">為參數(shù),面向?qū)ο笸ㄟ^時才運行。當(dāng)ARRAY_A </ins>或ARRAY_N在$wpdb-&gt;get_results()通過時,setup_postdata()似乎不運行。</div></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr> <!-- diff cache key wiki-zz_:diff::1.12:old-13185:rev-13208 --> </table> Doreen