我试图从特定类别中提取内容,并将它们显示在主页上,并且从该条目的自定义字段中提取图像。一切看起来像是工作正常..第二个条目的工作原理应该是,但是第一个条目,只有图像链接回帖子,标题和阅读更多链接不被鼠标识别为链接。看着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