It includes the custom post taxonomy and supports (like thumbnail, categories, and excerpt)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | define( 'LW_TEXT_DOMAIN' , 'lightweight' ); $slug = 'portfolio' ; $labels = array ( // The plural form of the name of your post type. 'name' => __( 'Portfolio' ,LW_TEXT_DOMAIN), // The singular form of the name of your post type. 'singular_name' => __( 'Portfolio' ,LW_TEXT_DOMAIN), // The rewrite of the post type 'rewrite' => array ( // prepends our post type with this slug 'slug' => __( 'portfolio' ,LW_TEXT_DOMAIN) ), // The menu item for adding a new post. 'add_new' => _x( 'Add Item' , 'portfolio' ,LW_TEXT_DOMAIN), // The header shown when editing a post. 'edit_item' => __( 'Edit Portfolio Item' ,LW_TEXT_DOMAIN), // Shown in the favourites menu in the admin header. 'new_item' => __( 'New Portfolio Item' ,LW_TEXT_DOMAIN), // Shown alongside the permalink on the edit post screen. 'view_item' => __( 'View Portfolio' ,LW_TEXT_DOMAIN), // Button text for the search box on the edit posts screen. 'search_items' => __( 'Search Portfolio' ,LW_TEXT_DOMAIN), // Text to display when no posts are found through search in the admin. 'not_found' => __( 'No Portfolio Items Found' ,LW_TEXT_DOMAIN), // Text to display when no posts are in the trash. 'not_found_in_trash' => __( 'No Portfolio Items Found In Trash' ,LW_TEXT_DOMAIN), // Used as a label for a parent post on the edit posts screen. Only useful for hierarchical post types. 'parent_item_colon' => '' ); // Set Up The Arguements $args = array ( // Pass The Array Of Labels 'labels' => $labels , // Display The Post Type To Admin 'public' => true, // Allow Post Type To Be Queried 'publicly_queryable' => true, // Build a UI for the Post Type 'show_ui' => true, // Use String for Query Post Type 'query_var' => true, // Rewrite the slug 'rewrite' => true, // Set type to construct arguements 'capability_type' => 'post' , // Disable Hierachical - No Parent 'hierarchical' => false, // Set Menu Position for where it displays in the navigation bar 'menu_position' => 200, // Allow the portfolio to support a Title, Editor, Thumbnail 'supports' => array ( 'title' , 'editor' , 'thumbnail' ) , 'rewrite' => array ( // prepends our post type with this slug 'slug' => $slug ), ); // Register The Post Type register_post_type(__( 'portfolio' ,LW_TEXT_DOMAIN), $args ); // Register the Taxonomy register_taxonomy(__( "filter" ,LW_TEXT_DOMAIN), // Assign the taxonomy to be part of the portfolio post type array (__( "portfolio" ,LW_TEXT_DOMAIN)), // Apply the settings for the taxonomy array ( "hierarchical" => true, "label" => __( "Categories" ,LW_TEXT_DOMAIN), "singular_label" => __( "Categories" ,LW_TEXT_DOMAIN), "rewrite" => array ( 'slug' => 'filter' , 'hierarchical' => true ) ) ); add_post_type_support( 'portfolio' , 'excerpt' ); |