Advertisement
ncamaa1

Untitled

Sep 26th, 2021
1,319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.07 KB | None | 0 0
  1. <?php
  2.  
  3. //==========================================================================================
  4. // Community Posts =============================================================================
  5. //==========================================================================================
  6. function cws_register_community_post() {
  7.   $labels = array(
  8.       'name'               => _x( 'Community Posts', 'post type general name', 'cws' ),
  9.       'singular_name'      => _x( 'Community Post', 'post type singular name', 'cws' ),
  10.       'add_new'            => _x( 'Add New', 'community_post', 'cws' ),
  11.       'add_new_item'       => __( 'Add New Community Post', 'cws' ),
  12.       'edit_item'          => __( 'Edit Community Post', 'cws' ),
  13.       'new_item'           => __( 'New Community Post', 'cws' ),
  14.       'all_items'          => __( 'Community Posts', 'cws' ),
  15.       'view_item'          => __( 'View Community Post', 'cws' ),
  16.       'search_items'       => __( 'Search Community Posts', 'cws' ),
  17.       'not_found'          => __( 'No Community Posts found', 'cws' ),
  18.       'not_found_in_trash' => __( 'No Community Posts found in the trash', 'cws' ),
  19.       'parent_item_colon'  => '',
  20.       'menu_name'          => 'Community Posts'
  21.   );
  22.   $args   = array(
  23.       'labels'          => $labels,
  24.       'description'     => __( 'All Community Posts.', 'cws' ),
  25.       'public'          => true,
  26.       'menu_position'   => 25,
  27.       'show_in_menu'      => 'community-menu',
  28.       // 'hierarchical'    => true,
  29.       'supports'        => array( 'title', 'editor', 'thumbnail', 'page-attributes' ),
  30.       'has_archive'     => false,
  31.       'rewrite'         => array( 'slug' => 'community/%community_post_domain%', 'with_front' => false ),
  32.       'capability_type' => 'community_post',
  33.       'capabilities'    => array(
  34.           'read_post'   => 'read_community_posts',
  35.           'edit_post'   => 'edit_community_posts',
  36.           'delete_post' => 'delete_community_posts',
  37.       ),
  38.   );
  39.   register_post_type( 'community_post', $args );
  40. }
  41. add_action( 'init', 'cws_register_community_post' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement