我正在尝试组合一个短代码,让用户循环帖子,但按id排除特定帖子。
$atts = array_change_key_case((array)$atts, CASE_LOWER);
// override default attributes with user attributes
$custom_atts = shortcode_atts([
\'link\' => \'off\',
\'hide\' => \'\',
\'only\' => \'\',
\'reverse\' => \'\',
], $atts, $tag);
$args = array(
\'cat\' => 113,
\'post_type\' => \'page\',
\'posts_per_page\' => \'-1\',
\'order\' => \'ASC\',
\'post_parent\' => $current_id,
\'post__not_in\' => array($custom_atts[\'hide\'])
);
$the_query = new WP_Query( $args );
然后,短代码如下所示:
[customposts hide="7043,7128"]
但不管出于什么原因,它只是隐藏属性中列出的第一篇帖子。
有什么想法吗?