我有许多由父库组织的子库(多个父库,下有几个子库)。
我想创建一个快捷码,可以查询指定父库下的所有子库。我有点困难。。。有人愿意帮我吗?
这是迄今为止我拥有的功能:
function display_gallery_cards($atts) {
global $post;
$defaults = array(
\'sort_column\' => menu_order,
\'title_li\' => \'\',
\'child_of\' => \'\',
\'depth\' => 1,
\'echo\' => 0,
\'parentgal\' => \'\',
\'walker\' => new Thumbnail_walker()
);
$args = wp_parse_args( $args, $defaults );
$childpages = wp_list_pages(array(
\'sort_column\' => menu_order,
\'title_li\' => \'\',
\'child_of\' => $args[\'parentgal\'],
\'depth\' => 1,
\'echo\' => 0,
\'walker\' => new Thumbnail_walker()
));
if ( $childpages ) {
$string = \'<ul class="two-columns">\' . $childpages . \'</ul><div class="clearfix"></div>\';
}
return $string;
}
add_shortcode( \'list-cards\', \'display_gallery_cards\' );
当我执行[列出卡片parentgal=\'941\']时,输出显示良好,但显示的页面错误。我是否正确传递了“父库”帖子ID?