Skip to main content

Create a Custom Post Type

Home Forums WordPress Custom Posts Create a Custom Post Type

Viewing 0 reply threads
  • Author
    Posts
    • #2478

      Layer7web
      Keymaster
      /**
       * Custom Post Type Example
       */
      add_action( 'init', 'l7w_register_custom_posts_example_init' );
      function l7w_register_custom_posts_example_init() {
          // Register Example
          $board_labels = array(
              'name'               => 'Example Name',
              'singular_name'      => 'Example',
              'menu_name'          => 'Example',
              'add_new_item'       => 'Add Example',
              'edit_item'          => 'Edit Example'
          );
          $board_args = array(
              'labels'             => $board_labels,
              'public'             => true,
              'capability_type'    => 'post',
              'has_archive'        => true,
              'menu_icon'          => 'dashicons-id-alt',
              'supports'           => array( 'title', 'editor', 'revisions' )
          );
          register_post_type( 'exmaple', $board_args );
      }
      
      • This topic was modified 9 years, 6 months ago by Layer7web.
Viewing 0 reply threads

You must be logged in to reply to this topic.