Here is the code I’m using to get my custom post type and taxonomy. Does it look right?
add_action('init', 'portfolio');
function portfolio()
{
$labels = array(
'name' => _x('Portfolio', 'post type general name'),
'singular_name' => _x('Portfolio', 'post type singular name'),
'add_new' => _x('Add New', 'project'),
'add_new_item' => __('Add New Project'),
'edit_item' => __('Edit Project'),
'new_item' => __('New Project'),
'view_item' => __('View Project'),
'search_items' => __('Search Projects'),
'not_found' => __('No projects found'),
'not_found_in_trash' => __('No projects found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => 4,
'_builtin' => false,
'supports' => array('title','editor','thumbnail','custom-fields','cats')
);
register_post_type('portfolio',$args);
}
register_taxonomy( 'media', 'portfolio', array( 'hierarchical' => false, 'label' => __('Media Type'), 'query_var' => 'media' ) );
Here is the code I’m using in my page file to try and get the ‘media’ => ‘print’ to pass through.
<?php query_posts( array( 'post_type' => 'portfolio', 'media' => 'print' ) );
while (have_posts() ) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile; ?>