Skip to content

Instantly share code, notes, and snippets.

@wpspeak

wpspeak/functions.php

Last active Apr 16, 2019
Embed
What would you like to do?
Create a simple Portfolio Custom Post Type
<?php
// Create portfolio custom post type
add_action( 'init', 'register_cpt_portfolio' );
function register_cpt_portfolio() {
register_post_type( 'portfolio',
array(
'labels' => array(
'name' => __( 'Portfolio', 'portfolio' ),
'singular_name' => __( 'Portfolio', 'portfolio' ),
),
'exclude_from_search' => true,
'has_archive' => true,
'hierarchical' => true,
'public' => true,
'rewrite' => array( 'slug' => 'portfolio' ),
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes' ),
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment