<?php
$pages = get_posts( array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'post_date',
'orderby' => 'meta_value_num',
'posts_per_page' => 4
) );
echo $post_id = $pages->ID ;
echo $post_thumbnail_id = get_post_thumbnail_id( $post_id );
?>
在上面,代码我想跳过我的第一篇文章并显示其余部分。
答案 0 :(得分:1)
试试这个:
使用get_posts()参数的offset
参数。
$pages = get_posts( array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'post_date',
'orderby' => 'meta_value_num',
'posts_per_page' => 4,
'offset'=>'1' //USE OFFSET PARAMETER
) );
//echo '<pre>';
//print_r($pages); //Retrieve post lists
echo $post_id = $pages->ID ;
echo $post_thumbnail_id = get_post_thumbnail_id( $post_id )