图像php下方的行 [英] Lines below image php
问题描述
我试图在本网站底部的图片下方显示来自帖子的一行摘录:http://www.wha2wear.com/这是用于获取图像和摘录的php函数:
<h2><span>潜行峰值</span></h2><ul><?php query_posts('orderby=comment_count&posts_per_page=6');如果( have_posts() ):while ( have_posts() ) : the_post();?><li><h3 class="short_title"><a title="帖子:<?php the_title(); ?>"href="
问题出在其中摘录显示在照片旁边的两张照片上,而不是显示在照片下方......谢谢!
您的问题是您的显示依赖于数据.以 <br>
或 <p>
开头的简介将换行,否则不会.将它们包裹在 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');回声'...</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');回声'...</a>';echo '</li>';?></a>
I'm trying to display one line of excerpt from posts beneath the images at the bottom of this website: http://www.wha2wear.com/ This is the php function used to get the images and the excerpt:
<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>
The problem is on two of the photos the excerpt is showing next to the photo instead if beneath it...thank you!
Your problem is that your display is dependent on the data. A blurb starting with <br>
or <p>
will wrap, otherwise not. Wrap them in div
s to make them line up properly:
<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>
You could also just force a line break between the two:
<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>
这篇关于图像php下方的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!