Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IN FUNCTIONS.PHP or best way in (IN FUNCTIONS.PHP includes) include/custom-post-type.php
- OR USE PLUGIN wp cpt ui - not reliably
- (IMPORTANT TO WRITE VALUE TRUE IN custom post == 'has_archive' => true, == if you need custom post type archive page
- <?php
- /**
- * Create custom post types.
- */
- add_action('init', 'create_posttype');
- function create_posttype()
- {
- register_post_type('testimonials',
- array(
- 'supports' => array('title', 'editor'),
- 'labels' => array(
- 'name' => __('Testimonials'),
- 'singular_name' => __('Testimonial')
- ),
- 'public' => true,
- 'menu_position' => 5,
- 'menu_icon' => 'dashicons-format-quote',
- 'rewrite' => array('slug' => 'testimonials'),
- )
- );
- register_post_type('logo',
- array(
- 'supports' => array('title', 'editor'),
- 'labels' => array(
- 'name' => __('Logo'),
- 'singular_name' => __('Logo')
- ),
- 'public' => true,
- 'menu_position' => 6,
- 'menu_icon' => 'dashicons-images-alt2',
- 'rewrite' => array('slug' => 'logo'),
- )
- );
- register_post_type('blog',
- array(
- 'supports' => array(
- 'title',
- 'editor',
- 'custom-fields',
- 'revisions',
- 'page-attributes',
- 'thumbnail'
- ),
- 'labels' => array(
- 'name' => __('Blog'),
- 'singular_name' => __('Blog')
- ),
- 'public' => true,
- 'menu_position' => 3,
- 'menu_icon' => 'dashicons-book',
- 'has_archive' => true,
- 'rewrite' => array(
- 'slug' => 'blog',
- 'with_front' => false
- ),
- )
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement