/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//-----------register custom post type register_post_type( 'projects', 'name' => __( 'Projects' ), 'singular_name' => __( 'Project' ), 'add_new' => _x('Add New', 'Project'), 'add_new_item' => __('Add New Project'), 'edit_item' => __('Edit Project'), 'new_item' => __('New Project'), 'view_item' => __('View Projects'), ), 'public' => true, 'show_ui' => true, 'menu_icon' => get_stylesheet_directory_uri() . '/assets/images/icon-project.png', 'hierarchical' => false, //it means we cannot have parent and sub pages 'capability_type' => 'post', //will act like a normal post 'rewrite' => 'projects', //this is used for rewriting the permalinks 'query_var' => false, ) ); //fixes permalinks issue with custom post types flush_rewrite_rules();