开发者

WordPress: Giving a sticky post a specific fixed order

Is there a way to 开发者_高级运维give a sticky post a specific order, rather than always displaying at the top of the list? For example, I want one sticky post to always display as the 5th post, and another to always display as the 8th.

Thanks!


//------------ Add page ordering for posts ----------------//

function dark_post_prepare( $query ) {
    $query->set( 'orderby', array('menu_order' => 'ASC', 'ID'=>'DESC') );
}
add_action( 'pre_get_posts', 'dark_post_prepare', 1 );

//---------------- Register: Page-atributes to post (Add order of post)
add_action( 'admin_init', 'dark_posts_order' );
function dark_posts_order() {
    add_post_type_support( 'post', 'page-attributes' );
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜