Wordpress-创建自定义分类

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Wordpress-创建自定义分类相关的知识,希望对你有一定的参考价值。

  1. function create_theme_taxonomy() {
  2.  
  3.  
  4. register_taxonomy('ville-activite', array('activite'), array(
  5. 'hierarchical' => TRUE,
  6. 'label' => 'Villes - Activités',
  7. 'singular_label' => 'Ville - Activités',
  8. 'public' => TRUE,
  9. 'show_ui' => TRUE,
  10. 'show_tagcloud' => FALSE,
  11. 'rewrite' => FALSE
  12. ));
  13.  
  14. register_taxonomy('ville-restaurant', array('restaurant'), array(
  15. 'hierarchical' => TRUE,
  16. 'label' => 'Villes - Restaurants',
  17. 'singular_label' => 'Ville - Restaurants',
  18. 'public' => TRUE,
  19. 'show_ui' => TRUE,
  20. 'show_tagcloud' => FALSE,
  21. 'rewrite' => FALSE
  22. ));
  23.  
  24. register_taxonomy('ville', array('activite','restaurant'), array(
  25. 'hierarchical' => TRUE,
  26. 'label' => 'Villes',
  27. 'singular_label' => 'Ville',
  28. 'public' => TRUE,
  29. 'show_ui' => TRUE,
  30. 'show_tagcloud' => FALSE,
  31. 'rewrite' => FALSE
  32. ));
  33.  
  34. }
  35. add_action( 'init', 'create_theme_taxonomy', 0 );

以上是关于Wordpress-创建自定义分类的主要内容,如果未能解决你的问题,请参考以下文章

PHP Wordpress - 创建自定义分类

Wordpress-创建自定义分类

Wordpress自定义Post类型注册

WordPress > 从自定义帖子类型获取自定义分类

在 Wordpress 自定义帖子类型循环中使用 ACF 分类字段作为变量

在 WordPress 中显示当前的帖子自定义分类