我試圖從特定類別中提取內容,並將它們顯示在主頁上,並且從該條目的自定義字段中提取圖像。一切看起來像是工作正常..第二個條目的工作原理應該是,但是第一個條目,只有圖像鏈接回帖子,標題和閱讀更多鏈接不被鼠標識別爲鏈接。看着html,似乎php正在打印所有的東西,所以我認爲它一定是一個CSS問題,但我清除了所有相關的樣式,並且鏈接仍然不被識別。使用自定義字段的奇怪問題
這裏是PHP我對主頁
<?php
// Show custom fields from Food Category
query_posts('showposts=2&cat=3'); ?>
<?php while (have_posts()) : the_post(); ?>
<?php
// This is added to show <!--more--> on home page
global $more;
$more = 0;
?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<img src="<?php
$values = get_post_custom_values("food_thumb"); echo $values[0]; ?>" alt="" /></a></div>
<div class="span-3">
<p class="smallTitle">
<a href="<?php the_permalink() ?>" rel="bookmark">
<?php the_title(); ?></a></p></div>
<div class="span-1 theDate">
<?php the_time('m.d.y') ?>
</div>
<div class="span-4">
<?php the_content('<span class="moretext">Read more...</span>'); ?>
</div>
<?php endwhile; ?>
的HTML輸出看上去很好..
<div class="span-4 fixed-height-sidebar">
<div class="smallthumb"><a href="http://southendseattle.com/?p=24" rel="bookmark" title="Permanent Link to Food Test 1"><img src="foodthumb.jpg" alt="" /></a></div>
<div class="span-3">
<p class="smallTitle"><a href="http://.com/?p=24" rel="bookmark">
Food Test 1</a></p></div>
<div class="span-1 theDate">
07.16.09</div>
<div class="span-4 fixed-height-sidebar">
<p>Mmmmmmmm. Food. Aliquam libero libero, luctus ut tristique pulvinar, euismod at diam. In hac habitasse platea dictumst. Lorem ipsum dolor sit amet, <a href="http://southendseattle.com/?p=24#more-24" class="more-link"><span class="moretext">Read more…</span></a></p>
</div>
<div class="smallthumb"><a href="http://.com/?p=3" rel="bookmark" title="Permanent Link to Food test page -2"><img src="http://.com/wp-content/uploads/2009/07/foodthumb2.jpg" alt="" /></a></div>
<div class="span-3">
<p class="smallTitle"><a href="http://.com/?p=3" rel="bookmark">
Food test page -2</a></p></div>
<div class="span-1 theDate">
07.12.09</div>
<div class="span-4">
<p>「Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In nec odio vitae nunc euismod vulputate. Integer aliquam ullamcorper tortor, nec suscipit magna viverra in. Nunc urna neque, dapibus id congue et, dignissim vitae augue. Aliquam et bibendum lacus. <a href="http://southendseattle.com/?p=3#more-3" class="more-link"><span class="moretext">Read more…</span></a></p>
</div>
</div>
下面是截圖,以幫助解釋我的問題...
alt text http://zacharydesigns.com/temp/wpsample.jpg
HTML中的那些URL是否輸出了真正的URL,還是截斷了它們?這些http://.com/?p = 3網址可能不是您想要的。 – Jacob 2009-07-19 16:09:36
是啊我截斷他們 – Zac 2009-07-19 17:52:34