
內容簡介
Sticky CPT 外掛允許使用者將自訂文章類型(CPT)內容設為置頂,類似於 WordPress 核心對於文章的功能。這樣可以輕鬆突出顯示新創建的內容,並支援快速編輯及批量操作。
【主要功能】
• 支援自訂文章類型的置頂功能
• 快速編輯和批量操作的便捷性
• 在區塊編輯器和經典編輯器中均可使用
• 置頂項目存儲於核心 sticky_posts 選項
• 兼容 is_sticky() 函數
外掛標籤
開發者團隊
原文外掛簡介
The plugin allows to highlight the CPT in the same way as would the WordPress core functionality for posts.
You can highlight new content created for your CPT.
It is also possible to highlight the content quickly thanks to quick edit and bulk actions.
The sticky checkbox is available in the block editor, in the classic editor, in quick edit and in bulk edit, for every public custom post type.
Sticky items are stored in the core sticky_posts option, exactly like sticky posts: is_sticky() works out of the box.
Start example
$args = array(
'post_type' => ['project'],
'post_status' => 'publish',
'posts_per_page' => -1,
'post__in' => get_option( 'sticky_posts' )
);
$stickyProject = new WP_Query( $args );
Hook available
add_filter( 'sticky_cpt_add_cpt' , 'add_cpt' );
function add_cpt( $post_types ) {
$post_types['newcpt'] = 'newcpt';
return $post_types;
}
