• Resolved berfarah

    (@berfarah)


    I have been bashing my head against this for… probably at least 8 hours total, I just can’t find anything on Google that will fix this, and I can’t for the life of me find where I screwed up. I disabled all plugins and still nothing.

    I but “body_class()” into HTML comments, and it still gives me “tax-skill” and “term-[theterm]” – so something must be going right somewhere, it just refuses to fetch the posts.

    Here’s the code for the custom post type and custom taxonomy to go along with it – most of it I grabbed from tutorials here and there, the rest from the codex.

    add_action('init', 'portfolio_post_type',0);
    
    function portfolio_post_type() {
    	$labels = array(
    		// You can alter the text on any of these
    		'name' => _x('Portfolio', 'post type general name'),
    		'singular_name' => _x('Item', 'post type singular name'),
    		'add_new' => _x('Add Item', 'Event Item'),
    		'add_new_item' => __('Add New Item'),
    		'edit_item' => __('Edit Item'),
    		'new_item' => __('New Item'),
    		'view_item' => __('View Item Details'),
    		'search_items' => __('Search Portfolio Items'),
    		'not_found' => __('No portfolio items were found with that criteria'),
    		'not_found_in_trash' => __('No portfolio items found in the Trash with that criteria'),
    		'view' => __('View Item')
    	);
    
    	$args = array(
    		'labels' => $labels,
    		// We can give our post type a description in case we forget what its for
    		'description' => 'This is the holding location for all portfolio items',
    		'public' => true,
    		'publicly_queryable' => true,
    		// To keep in the search, or to not keep in the search. That is the question.
    		'exclude_from_search' => true,
    		'show_ui' => true,
    		'rewrite' => true,
    		'hierarchical' => false,
    		'menu_position' => null,
    		'supports' => array('title', 'editor', 'thumbnail', 'custom-fields', 'revisions')
    	);
    
    	register_post_type('portfolio',$args);
    
    	//swiss
    	$labels = array(
    		'name' => _x('Skills', 'taxonomy general name'),
    		'singular_name' => _x('Skill', 'taxonomy singular name'),
    		'search_items' => __('Search Skills'),
    		'popular_items' => __('Popular Skills'),
    		'all_items' => __('All Skills'),
    		'parent_item' => null,
    		'parent_item_colon' => null,
    		'edit_item' => __('Edit Skill'),
    		'update_item' => __( 'Update Skill' ),
    		'add_new_item' => __( 'Add New Skill' ),
    		'new_item_name' => __( 'New Skill Name' ),
    		'separate_items_with_commas' => __( 'Separate skills with commas' ),
    		'add_or_remove_items' => __( 'Add or remove skills' ),
    		'choose_from_most_used' => __( 'Choose from the most used skills' )
    	);
    	register_taxonomy( 'skill', 'portfolio', array(
    		'hierarchical' => false,
    		'labels' => $labels, /* NOTICE: the $labels variable here */
    		'public' => true,
    		'show_ui' => true,
    		'query_var' => true,
    		'rewrite' => true
    	));
    	//end swiss
    }

    My taxonomy.php file is a very simple loop – I have tried removing it to see if the normal archives.php would show posts, but nada. I’m… at the end of my strength on this one. I want to give people the option to see my portfolio pieces in their respective taxonomies, but I really can’t afford to spend more time on this.

    Please, help me! Thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter berfarah

    (@berfarah)

    Found the issue – turns out even though it’s tied to the custom post, it still assumes you want to query normal posts (no idea why this is), so I added this to my template and it works:

    global $wp_query;
    $args = array_merge( $wp_query->query, array( 'post_type' => 'portfolio' ) );
    query_posts( $args );
Viewing 1 replies (of 1 total)
  • The topic ‘Custom Taxonomy not showing posts’ is closed to new replies.