說明
wordpress 檢查當前文章是否置頂。返回值TRUE 或者 FALSE.
用法
- <?php?is_sticky($post_ID);??>
參數
$post_ID
(string) (optional) 文章 ID
默認: None
返回值
(boolean)
True,或 false.
示例
- is_sticky();
- is_sticky('17');
源文件
is_sticky() 位于 wp-includes/post.php.
- function?is_sticky(?$post_id?=?0?)?{
- ?$post_id?=?absint(?$post_id?);
- ?if?(?!?$post_id?)
- ??$post_id?=?get_the_ID();
- ?$stickies?=?get_option(?'sticky_posts'?);
- ?if?(?!?is_array(?$stickies?)?)
- ??return?false;
- ?if?(?in_array(?$post_id,?$stickies?)?)
- ??return?true;
- ?return?false;
- }