Friday, December 5, 2014

Wordpress Custom Post Category Codex

Custom post INC file


<?php
/**
 * Updates Module custom post type
 */
add_action('init', 'recent_works_post_type_register');
function recent_works_post_type_register() {
register_post_type( 'recent_works' ,
array(
'label' => 'Recent Works',
'singular_label' => 'Recent Works',
'public' => true,
'show_ui' => true,
//'menu_icon' => get_stylesheet_directory_uri() . '/images/testimonials-icon.png',
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => true,
'show_in_nav_menus' => true,
'supports' => array('title','thumbnail')
)
);

add_filter('manage_edit-recent_works_columns', 'recent_works_edit_columns');

function recent_works_edit_columns($columns){
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => 'Recent Works',
'author'=> 'Author',
'date' =>'Date'
);

return $columns;
}
}

/* Set up the taxonomies. */
add_action( 'init', 'recent_works_taxonomies', 0);
/* Registers taxonomies. */
function recent_works_taxonomies() {
/* Set up the artist taxonomy arguments. */
$category_args = array(
'hierarchical' => true,
'query_var' => true,
'show_ui' => true,
'show_in_nav_menus' => false,
'rewrite' => array(
'slug' => 'recent_works'),
'labels' => array(
'name' => 'recent_works Category',
'singular_name' => 'recent_works Category',
'edit_item' => 'Edit Category',
'update_item' => 'Update Category',
'add_new_item' => 'Add New Category',
'new_item_name' => 'New Category',
'all_items' => 'All Categories',
'search_items' => 'Search Category',
'parent_item' => 'Parent Category',
'parent_item_colon' => 'Parent Category:',
),
);
/* Register the technology taxonomy. */
register_taxonomy( 'recent_works_category', array('recent_works'), $category_args );
}


?>

No comments:

Post a Comment