Advertisement
ohidul

WordPress custom post type slug rewriting

Jan 17th, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.75 KB | None | 0 0
  1.         $labels = array(
  2.             'name'               => _x( 'Portfolio' , 'post type general name', 'maxive' ),
  3.             'singular_name'      => _x( 'Portfolio', 'post type singular name', 'maxive' ),
  4.             'menu_name'          => _x( 'Portfolio' , 'admin menu', 'maxive' ),
  5.             'name_admin_bar'     => _x( 'Portfolio', 'add new on admin bar', 'maxive' ),
  6.             'add_new'            => __( 'Add New Portfolio', 'maxive' ),
  7.             'add_new_item'       => __( 'Add New Portfolio', 'maxive' ),
  8.             'new_item'           => __( 'New Portfolio', 'maxive' ),
  9.             'edit_item'          => __( 'Edit Portfolio', 'maxive' ),
  10.             'view_item'          => __( 'View Portfolio', 'maxive' ),
  11.             'all_items'          => __( 'All Portfolios', 'maxive' ),
  12.             'search_items'       => __( 'Search Portfolios', 'maxive' ),
  13.             'parent_item_colon'  => __( 'Parent :', 'maxive' ),
  14.             'not_found'          => __( 'No Portfolios found.', 'maxive' ),
  15.             'not_found_in_trash' => __( 'No Portfolios found in Trash.', 'maxive' )
  16.         );
  17.  
  18.         $args = array(
  19.             'labels'             => $labels,
  20.             'description'        => __( 'Description.', 'maxive' ),
  21.             'public'             => true,
  22.             'publicly_queryable' => true,
  23.             'show_ui'            => true,
  24.             'show_in_menu'       => true,
  25.             'query_var'          => true,
  26.             'menu_icon'          => 'dashicons-businessman',
  27.             'rewrite'            => array( 'slug' => 'Portfolio', 'with_front' => true, 'pages' => true, 'feeds' => true ),
  28.             'capability_type'    => 'post',
  29.             'has_archive'        => true,
  30.             'hierarchical'       => true,
  31.             'menu_position'      => null,
  32.             'menu_icon'          => 'dashicons-admin-appearance',
  33.             'supports'           => array( 'title', 'editor', 'thumbnail', 'excerpt', 'page-attributes')
  34.         );
  35.  
  36.         register_post_type('portfolio', $args);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement