WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sorry the question might not make sense. I basically have a custom post type called "Projects" and I need to create a way to filter attributes of the project like "name", "type", etc.

For example if I have a project type called airplane, and another project type called airplane. I would want to be able to search for all projects with the name airplane, and display those in the loop.

I have looked into Taxonomies, but I do not know how to use them effectively.


share|improve this question
up vote 1 down vote accepted

This is how I did it. If you have your custom post type as "projects", and your category as "airplane".

If you're not planning on using the pre-build loop you would make another one called loop-projects.php. However, it's not necessary.

                $args = array(
                    'numberposts'    => 5,
                    'post_type'      => 'projects',
                    'category_name'  => 'airplane');
                query_posts( $args );
                get_template_part( 'loop', 'projects' );
share|improve this answer
ok i don't know exactly how to setup categories – Jeff Feb 18 '11 at 22:32

If I understand your description right, structure goes like this:

  • custom post type Project;
  • Type is taxonomy associated with Project CPT;
  • Airplane is term in Type taxonomy.

In current WP version you can query for this like (but will get changed in WP 3.1):

query_posts( array( 'post_type' => 'project','type' => 'airplane' ) );

See Taxonomy Parameters in Codex.

share|improve this answer

Simple as this:

// default filter:  
apply_filters( 'your_filter_name', $val_to_filter );  
// or, make it more specific:   
apply_filters( 'your_filter_name_'.$val_to_filter, $val_to_filter );

You can add this somewhere before your register_post_type call, so it would look like this:

// assuming, you got an $args array to make it easy to handle:  
$args['name'] = apply_filters('your_name_filter', $args['name'] );  
$args['name'] = apply_filters('your_name_filter_'.$args['name'], $args['name']);  
$args['type'] = apply_filters('your_type_filter', $args['type']);  
$args['type'] = apply_filters('your_type_filter_'.$args['type'], $args['type']);    
$name = $args['name'];    
register_post_type( $name, $args );
share|improve this answer
Mpf. Misunderstood you. "Filter" is a biased term in "wordpress language".. – kaiser Feb 18 '11 at 21:07
Biased? How so? – t31os Feb 19 '11 at 15:11
Maybe biased is not the right word (learned it yesterday). I meant with "filter" you would normally associate filters like in the answer above apply_filters. – kaiser Feb 19 '11 at 21:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.