2014-02-09 27 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><p>開頭的blurb將包裝,否則將包裝。總結他們在div s到讓他們正確地排隊:

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

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

你也可以只強制兩者之間的換行符:

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

你好,謝謝你的回答,我不知道是什麼把insedd的imageDiv和blurbDiv,我仍然是一個菜鳥對不起 – Candice

+0

你可以從字面上把那些作爲id,或者離開id。我通常給每個div一個唯一的名字,以防我需要在javascript中解決它,但在這種情況下,它可能並不重要。 –

+0

謝謝,我嘗試了兩種方式,但它只是搞亂了造型:http://www.wha2wear.com/ – Candice