Advertisement
Guest User

Untitled

a guest
Sep 5th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. <?php
  2.  
  3. // Regsiter the Sections Taxonomy
  4.  
  5. if ( ! function_exists( 'gnl_section_taxonomy' ) ) {
  6.  
  7. // Register Custom Taxonomy
  8. function gnl_section_taxonomy() {
  9.  
  10. $labels = array(
  11. 'name' => _x( 'Sections', 'Taxonomy General Name', 'text_domain' ),
  12. 'singular_name' => _x( 'Section', 'Taxonomy Singular Name', 'text_domain' ),
  13. 'menu_name' => __( 'Sections', 'text_domain' ),
  14. 'all_items' => __( 'All Sections', 'text_domain' ),
  15. 'parent_item' => __( 'Parent Section', 'text_domain' ),
  16. 'parent_item_colon' => __( 'Parent Section:', 'text_domain' ),
  17. 'new_item_name' => __( 'New Section Name', 'text_domain' ),
  18. 'add_new_item' => __( 'Add New Section', 'text_domain' ),
  19. 'edit_item' => __( 'Edit Section', 'text_domain' ),
  20. 'update_item' => __( 'Update Section', 'text_domain' ),
  21. 'view_item' => __( 'View Section', 'text_domain' ),
  22. 'separate_items_with_commas' => __( 'Separate sections with commas', 'text_domain' ),
  23. 'add_or_remove_items' => __( 'Add or remove sections', 'text_domain' ),
  24. 'choose_from_most_used' => __( 'Choose from the most used', 'text_domain' ),
  25. 'popular_items' => __( 'Popular Sections', 'text_domain' ),
  26. 'search_items' => __( 'Search Sections', 'text_domain' ),
  27. 'not_found' => __( 'Not Found', 'text_domain' ),
  28. 'no_terms' => __( 'No Sections', 'text_domain' ),
  29. 'items_list' => __( 'Sections list', 'text_domain' ),
  30. 'items_list_navigation' => __( 'Sections list navigation', 'text_domain' ),
  31. );
  32. $args = array(
  33. 'labels' => $labels,
  34. 'hierarchical' => true,
  35. 'public' => true,
  36. 'show_ui' => true,
  37. 'show_admin_column' => false,
  38. 'show_in_nav_menus' => false,
  39. 'show_tagcloud' => false,
  40. 'show_in_rest' => true,
  41. );
  42.  
  43. // we are not applying it directly to a post type. We use it to feed metabox on post types
  44. register_taxonomy( 'section', array(), $args );
  45.  
  46. }
  47. add_action( 'init', 'gnl_section_taxonomy', 0 );
  48.  
  49. }
  50.  
  51.  
  52. // Add meta box options
  53. add_filter( 'rwmb_meta_boxes', 'gnl_section_meta_boxes' );
  54. function gnl_section_meta_boxes( $meta_boxes )
  55. {
  56.  
  57. $meta_boxes[] = array(
  58. 'title' => 'Other',
  59. 'taxonomies' => 'section', // Specifically for user
  60. 'fields' => array(
  61. array(
  62. 'id' => 'section_joomla_id',
  63. 'type' => 'number',
  64. 'name' => esc_html__( 'Joomla ID', 'metabox-online-generator' ),
  65. 'desc' => esc_html__( 'Just for initial importing', 'metabox-online-generator' ),
  66. 'readonly' => true,
  67. ),
  68. ),
  69. );
  70. return $meta_boxes;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement