我的存档页面和单页运行良好,我也需要自定义页面。例如,www.site.com/dates
是归档页面,www.site.com/dates/product1
是单页。我也需要几个月的页面,所以www.site.com/dates/january
,www.site.com/dates/february
等应该正常工作。
$months = array('january', 'february', 'march', ...);
$args = array(
'labels' => array(
'name' => 'Dates',
),
'rewrite' => array(
'slug' => 'dates'
),
'public' => true,
'publicly_queryable' => true,
'has_archive' => true,
'supports' => array('title', 'excerpt')
);
register_post_type('date-posttype', $args);
foreach(months as $month)
{
$args = array(
'labels' => array('name' => $month),
'hierarchical' => true,
'sort' => true,
'query_var' => $month_var
);
register_taxonomy($month_var, 'date-posttype', $args);
}
我可以使用自定义代码在这些月份页面工作时显示数据,但是如何让它们工作?