与其他帖子相比,最后一个粘贴帖子总是有不同的风格。我无法理解如何在没有粘贴的情况下显示所有帖子:(
我的代码:
<?php
$sticky = get_option('sticky_posts'); // show last sticky post
if (!empty($sticky)) {
$args['post__in'] = $sticky;
$qry = new WP_Query(array( 'posts_per_page' => 1, // yeah, last one
'post__in' => $sticky,
'ignore_sticky_posts' => 1));
if ($qry->have_posts()) :
while ($qry->have_posts()) : $qry->the_post();?>
<div class="blog-thumbs-sticky">
<a class="sticky" href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a>
<div class="blog-thumb-title-sticky"><a class="green" href="<?php the_permalink(); ?>"><?php $thetitle = $post->post_title; $getlength = strlen($thetitle); $thelength = 157; echo mb_substr($thetitle, 0, $thelength, 'UTF-8'); if ($getlength > $thelength) echo "..."; ?></a></div>
<div class="date-down"><?php the_date(' j F Y '); ?></div>
<div class="blog-thumb-desc"><?php echo substr(get_the_excerpt(), 0,350); ?>...</div>
</div>
<?endwhile; endif;} ?>
<!-- Here I want to see all other posts -->
<?php
$sticky = get_option('sticky_posts');
$not_sticky = get_option('sticky_posts');
if (!empty($not_sticky)) {
$args['post__not_in'] = $not_sticky;
$nqry = new WP_Query(array( 'posts_per_page' => 6,
'post__not_in' => array($sticky[0]), // how to delete newest sticky post, but show 2,3,4... sticky?
'ignore_sticky_posts' => 0));
if ($nqry->have_posts()) :
while ($nqry->have_posts()) : $nqry->the_post();?>
<div class="blog-thumbs-view-entry">
<div class="blog-thumb-title"><a href="<?php the_permalink(); ?>"><?php $thetitle = $post->post_title; $getlength = strlen($thetitle); $thelength = 157; echo mb_substr($thetitle, 0, $thelength, 'UTF-8'); if ($getlength > $thelength) echo "..."; ?>123</a></div>
<div class="date-down"><?php the_date(' j F Y '); ?></div>
<div class="blog-thumb-desc"><?php echo substr(get_the_excerpt(), 0,130); ?>...</div>
</div>
<?endwhile; endif;} ?>
非常感谢。
答案 0 :(得分:0)
尝试添加offset=1
来修改您的查询,它应该完成工作。