2009-07-17 38 views
0

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

下面是截图,以帮助解释我的问题...

alt text http://zacharydesigns.com/temp/wpsample.jpg

+0

HTML中的那些URL是否输出了真正的URL,还是截断了它们?这些http://.com/?p = 3网址可能不是您想要的。 – Jacob 2009-07-19 16:09:36

+0

是啊我截断他们 – Zac 2009-07-19 17:52:34

回答

1

我把你的HTML输出粘贴到空白处HTML页面(添加HTML/HEAD/BODY标签)。这两个链接呈现并正常工作。我在Firefox和IE中测试过。从它的外观来看,你的HTML输出很好。

你有可能发布整个页面的输出吗?

--Adam

+0

是的,谢谢,这就是我上面说的.. HTML输出是好的。整个页面超长,所以我刚刚发布了有效的部分。我认为这更多的是与我搞乱Wordpress循环。 – Zac 2009-07-21 16:22:26

0

是什么fixed-height-sidebar做在CSS?

这是两个条目之间的唯一区别。