以下示例是关于Whatever中包含wordpress只查询黏贴的帖子用法的示例代码,想了解wordpress只查询黏贴的帖子的具体用法?wordpress只查询黏贴的帖子怎么用?wordpress只查询黏贴的帖子使用的例子?那么可以参考以下相关源代码片段来学习它的具体使用方法。
// get sticky posts from DB
$sticky = get_option('sticky_posts');
// check if there are any
if (!empty($sticky)) {
// optional: sort the newest IDs first
rsort($sticky);
// override the query
$args = array(
'post__in' => $sticky
);
query_posts($args);
// the loop
while (have_posts()) {
the_post();
// your code
}
}
本文地址:https://www.itbaoku.cn/snippets/785381.html