I have everything the way I want it to be. I made categories using the custom taxonomy and added columns on post screens so that you can see the attributes for each post at a glance. Like the description of each post, the custom field value of each. But when I set the hierarchical value to true, the values on the columns disappear. I just want to be able to use the orderby=menu_order.
add_action('init', 'programming_register');
function programming_register() {
$labels = array(
'name' => _x('Programming', 'post type general name'),
'singular_name' => _x('Programming Item', 'post type singular name'),
'add_new' => _x('Add New', 'programming item'),
'add_new_item' => __('Add New Programming Item'),
'edit_item' => __('Edit Programming Item'),
'new_item' => __('New Programming Item'),
'view_item' => __('View Programming Item'),
'search_items' => __('Search Programming'),
'not_found' => __('Nothing found'),
'not_found_in_trash' => __('Nothing found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
'rewrite' => true,
'capability_type' => 'post',
'menu_position' => null,
'hierarchical' => false,
'orderby' => 'menu_order',
'supports' => array('title','editor','thumbnail','page-attributes')
);
register_post_type( 'programming' , $args );
}
add_action( 'init', 'create_schedule' );
function create_schedule() {
$labels = array(
'name' => _x( 'Schedule', 'taxonomy general name' ),
'singular_name' => _x( 'Schedule', 'taxonomy singular name' ),
'search_items' => __( 'Search schedule' ),
'all_items' => __( 'All schedule' ),
'parent_item' => __( 'Parent Schedule' ),
'parent_item_colon' => __( 'Parent Schedule:' ),
'edit_item' => __( 'Edit Schedule' ),
'update_item' => __( 'Update Schedule' ),
'add_new_item' => __( 'Add New Schedule' ),
'new_item_name' => __( 'New Schedule Name' ),
);
register_taxonomy('Schedule','programming',array(
'hierarchical' => true,
'labels' => $labels
));
}
add_action("admin_init", "admin_init");
function admin_init(){
add_meta_box("program_time-meta", "Program Time", "program_time", "programming", "side", "low");
add_meta_box("credits_meta", "Design & Build Credits", "credits_meta", "programming", "normal", "low");
}
function program_time(){
global $post;
$custom = get_post_custom($post->ID);
$program_time = $custom["program_time"][0];
?>
<label>Time Slot:</label>
<input name="program_time" value="<?php echo $program_time; ?>" />
<?php
}
function credits_meta() {
global $post;
$custom = get_post_custom($post->ID);
$designers = $custom["designers"][0];
$developers = $custom["developers"][0];
$producers = $custom["producers"][0];
?>
<p><label>Designed By:</label><br />
<textarea cols="50" rows="5" name="designers"><?php echo $designers; ?></textarea></p>
<p><label>Built By:</label><br />
<textarea cols="50" rows="5" name="developers"><?php echo $developers; ?></textarea></p>
<p><label>Produced By:</label><br />
<textarea cols="50" rows="5" name="producers"><?php echo $producers; ?></textarea></p>
<?php
}
add_action('save_post', 'save_details');
function save_details(){
global $post;
update_post_meta($post->ID, "program_time", $_POST["program_time"]);
update_post_meta($post->ID, "designers", $_POST["designers"]);
update_post_meta($post->ID, "developers", $_POST["developers"]);
update_post_meta($post->ID, "producers", $_POST["producers"]);
}
add_action("manage_posts_custom_column", "programming_custom_columns");
add_filter("manage_edit-programming_columns", "programming_edit_columns");
function programming_edit_columns($columns){
$columns = array(
"cb" => "<input type=\"checkbox\" />",
"title" => "Programming Title",
"description" => "Description",
"time" => "Program Time",
"Schedule" => "Schedule",
);
return $columns;
}
function programming_custom_columns($column){
global $post;
switch ($column) {
case "description":
the_excerpt();
break;
case "time":
$custom = get_post_custom();
echo $custom["program_time"][0];
break;
case "Schedule":
echo get_the_term_list($post->ID, 'Schedule', '', ', ','');
break;
}
}
This is my code. Thanks for your help.