我为WooCommerce产品创建了自定义分类。
<p>Further, to meet the diverse requirements of the clients, we offer the range in custom designs.
<ul>
<li>Features:
Elegant colors
Aesthetic designs
Matchless combination</li>
</ul>
</p>
登录管理员时这是有效的。当我想从前端尝试时,它无法正常工作。
function add_hunts_type(){
// Car Hunts
$cHunt_labels = array(
'name' => __( 'Hunts', 'pixar' ),
'singular_name' => __( 'Hunt', 'pixar' ),
'search_items' => __( 'Search Hunts', 'pixar' ),
'all_items' => __( 'All Hunts', 'pixar' ),
'parent_item' => __( 'Parent Hunt', 'pixar' ),
'parent_item_colon' => __( 'Parent Hunt:', 'pixar' ),
'edit_item' => __( 'Edit Hunt', 'pixar' ),
'update_item' => __( 'Update Hunt', 'pixar' ),
'add_new_item' => __( 'Add New Hunt', 'pixar' ),
'new_item_name' => __( 'New Hunt', 'pixar' ),
'menu_name' => __( 'Hunts', 'pixar' ),
);
$cHunt_args = array(
'labels' => $cHunt_labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'carhunt' )
);
register_taxonomy( 'car_Hunt', 'product', $cHunt_args );
}
add_action( 'init', 'add_hunts_type', 0 );
/* Flush rewrite rules for custom post types. */
add_action( 'after_switch_theme', 'flush_rewrite_rules' );
并重新生成如果我错过了什么,请告诉我。
答案 0 :(得分:0)
在WooCommerce中注册自定义分类
在function.php中添加以下函数
SELECT ?wikiURI ?timeWD ?popWD WHERE {
?wikiURI wdt:P31 wd:Q70208.
?wikiURI p:P1082 ?popWDStatement.
?popWDStatement ps:P1082 ?popWD;
pq:P585 ?timeWD.
FILTER NOT EXISTS {
?wikiURI wdt:P31 wd:Q70208. #-- this line is important for performance
?wikiURI p:P1082 ?popWDStatement_.
?popWDStatement_ ps:P1082 ?popWD_;
pq:P585 ?timeWD_.
FILTER (?timeWD_ > ?timeWD)}
} ORDER BY DESC(?popWD)