2014-02-10 36 views
0

我想在这个网站底部显示从图像下方的帖子摘录的一行:http://www.wha2wear.com/这是用于获取图像的PHP函数和摘录:图像摘录如下PHP

<div class="blog"> 
<h2><span>Sneak peak</span></h2> 
<ul> 
<?php query_posts('orderby=comment_count&posts_per_page=6'); if (have_posts()):  

while (have_posts()) : the_post(); ?> 

<li> 
<h3 class="short_title"><a title="Post: <?php the_title(); ?>" href="<?php 

the_permalink(); ?>"><?php echo ShortTitle(get_the_title()); ?> </a></h3> 

<a href="<?php the_permalink(); ?>"><?php getImage('1'); ?></a> 

<a href="<?php the_permalink(); ?>"><?php echo limit_words(get_the_excerpt(), '6'); 
    echo '...</a>'; 
    echo '</li>'; ?></a> 


<?php endwhile; ?></li> 
<?php else : ?> 
<p>Sorry, no posts were found.</p> 

</ul> 
</div> 

问题在于其中两张照片摘录显示在照片旁边,而不是它下面......谢谢!

回答

0

添加<br/>标签:

<a href="<?php the_permalink(); ?>"><?php getImage('1'); ?></a> 

<br/> 


<a href="<?php the_permalink(); ?>"><?php echo limit_words(get_the_excerpt(), '6'); 
+0

谢谢,但我已经尝试过,没有运气..它看起来像图像是直接从图像对齐到左侧和另一个右侧的帖子进行对齐grow hair Candice

0

你需要把它们变成的DIV和使用CSS,使他们正确地叠加到正确分配宽度。

从每个div中的每个'post'开始,然后在里面添加内容。

<div class="individual_post"> 
    <div class="post_title"> 
    <h3 class="short_title"><a title="Post: <?php the_title(); ?>" href="<?php 
    the_permalink(); ?>"><?php echo ShortTitle(get_the_title()); ?> </a></h3> 
    </div> 
    <div class="post_image"> 
    <a href="<?php the_permalink(); ?>"><?php getImage('1'); ?></a> 
    </div> 
    <div class="post_text"> 
    <a href="<?php the_permalink(); ?>"><?php echo limit_words(get_the_excerpt(), '6'); 
    echo '...</a>'; 
    </div> 
</div> 

然后用你的CSS,使各部分相同的宽度,使它们堆叠(即使它们应该是默认反正协议栈...)

希望这有助于。

+0

也尝试过没有运气:(谢谢 – Candice

+0

粘贴我的代码并链接到我的网站。看起来你必须有一些CSS与我写的内容相冲突,因为这是正确的。 –