• Hi,

    Is there a way to only pull from a category within a custom post type?

    For example, let’s say I have a custom post type “Work” which contains several sub-categories: Photos, Videos, etc. I’d like to set up a widget that only shows the Videos category within Work. The categories dropdown in the widget seems to only show categories from Posts, not from the custom post types.

    https://wordpress.org/plugins/ultimate-posts-widget/

Viewing 10 replies - 1 through 10 (of 10 total)
  • one more here

    Great plugin, but custom post type support without custom taxonomy support seems incomplete. Please add this. Thanks.

    Looking for the same.

    Same here. Oddly, the description on the main plugin page says “Filter by tags”, but that doesn’t seem to be true. I can neither sort by built-in tags, nor by my own custom taxonomies.

    Wondering….

    Would like to filter by custom taxonomies too.

    hamncheez

    (@hamncheez)

    yes, custom taxonomies?

    graffig

    (@graffig)

    unable to get custom post type categories to show either

    any news on update

    many thanks

    herooutoftime

    (@herooutoftime)

    I managed this by adding a filter as mentioned in the docs.

    <?php
    add_filter('upw_wp_query_args', 'upw_query', 10, 3);
    
    function upw_query($args, $instance, $base) {
    
    	$arguments = array();
    
    	switch ($instance['template_custom']) {
    		case 'footer/media':
    			$arguments = array(
    				'tax_query' => array(
    					array(
    						'taxonomy' => 'partner-type',
    						'field'    => 'slug',
    						'terms'    => 'media',
    					),
    				),
    			);
    			break;
    		case 'footer/partner':
    			$arguments = array(
    				'tax_query' => array(
    					array(
    						'taxonomy' => 'partner-type',
    						'field'    => 'slug',
    						'terms'    => array('media', 'featured'),
    						'operator' => 'NOT IN',
    					),
    				),
    			);
    			break;
    		default:
    			# code...
    			break;
    	}
    	return array_merge($args, $arguments);
    }
    ?>
    colinoakes

    (@colinoakes)

    @herooutoftime

    Can you explain more about your code and how/where to implement it?

    Thanks!

    Another vote for support of easier custom taxonomy use in widget’s filter section.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Category within custom post type?’ is closed to new replies.