Skip to content

Instantly share code, notes, and snippets.

@rodica-andronache
Created November 10, 2014 12:13
Show Gist options
  • Select an option

  • Save rodica-andronache/2b5ad9d4fe6fc9d50999 to your computer and use it in GitHub Desktop.

Select an option

Save rodica-andronache/2b5ad9d4fe6fc9d50999 to your computer and use it in GitHub Desktop.
Inregistrare custom post type
add_action( 'init', 'zerif_create_post_type' );
function zerif_create_post_type() {
/* portofolio */
register_post_type( 'portofolio',
array(
'labels' => array(
'name' => __( 'Portofolio','zerif' ),
'singular_name' => __( 'Portofolio','zerif' )
),
'public' => true,
'has_archive' => true,
'taxonomies' => array('category'),
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ),
'show_ui' => true,
)
);
/* testimonial */
register_post_type( 'testimonial',
array(
'labels' => array(
'name' => __( 'Testimonial','zerif' ),
'singular_name' => __( 'Testimonial','zerif' )
),
'public' => true,
'has_archive' => true,
'taxonomies' => array('post_tag'),
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ),
'show_ui' => true,
)
);
}
add_action('after_switch_theme', 'zerif_flush');
function zerif_flush () {
flush_rewrite_rules();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment