Wordpress 搜索结果的自定义布局
在Wordpress 3.5.1中,我想创建并使用自定义布局来显示搜索结果。我在谷歌上搜索到了,但这并不是我想要的 好吧,我解决了我的问题,现在非常高兴:) 我在Wordpress 搜索结果的自定义布局,wordpress,Wordpress,在Wordpress 3.5.1中,我想创建并使用自定义布局来显示搜索结果。我在谷歌上搜索到了,但这并不是我想要的 好吧,我解决了我的问题,现在非常高兴:) 我在search.php文件中编写以下脚本 while ( have_posts() ) { the_post(); //get_template_part( 'content', get_post_format() ); $permali
search.php
文件中编写以下脚本
while ( have_posts() ) {
the_post();
//get_template_part( 'content', get_post_format() );
$permalink = get_permalink($post->ID);
$title = get_the_title($post->ID);
$feed = truncate( strip_tags( get_the_content($post->ID) ), 0, 300, "[...]");
echo '<div class="posts">';
echo '<div style="float:left">';
echo '<a class="featured-img">
'.the_post_thumbnail('thumbnail').'
</a>';
echo '</div>';
echo '<div class="posts-content">';
echo '<div class="heading"><a href="'.$permalink.'">'.$title.'</a></div>';
echo '<div class="comments"> </div>'.
$feed
.'</div>';
echo '</div>';
}
while(have_posts()){
_post();
//获取模板部分(“内容”,获取发布格式());
$permalink=get\u permalink($post->ID);
$title=获取标题($post->ID);
$feed=truncate(剥离标签(获取内容($post->ID)),0,300,“[…]”;
回声';
回声';
回声';
回显“”。
$feed
.'';
回声';
}