Displaying tags associated with posts in Custom Post Type

You want to look into the_terms or its big brother get_the_terms. It’s how you display custom taxonomies on the front end — similar to the_category or the_tags. Example: <?php // somewhere in a template file, inside the loop the_terms( $post->ID, // object ID ‘camps_tag’, // your custom taxonomy ‘<p><strong>Tags: </strong></p>’, // before the list ‘, … Read more

Using wp_dropdown_categories in widget options

I got it 🙂 thanks to this function update( $new_instance, $old_instance ) { $instance = $old_instance; //Strip tags from title and name to remove HTML $instance[‘title’] = strip_tags( $new_instance[‘title’] ); $instance[‘kwtax’] = strip_tags( $new_instance[‘kwtax’] ); return $instance; } function form( $instance ) { //Set up some default widget settings. $defaults = array( ‘title’ => __(‘Equipment … Read more

Form to post new post with custom taxonomies

Update your form to include the term-id, instead of just <input type=”checkbox” /> use <input type=”checkbox” name=”taxonomy_id[]” value=”‘. $industryterm->term_id .'” />. That way you are actually sending along some values, in this case the term id. And in the args for wp_insert_post() make sure to include something like this: ‘tax_input’ => array( ‘industries’ => $_REQUEST[‘taxonomy_id’] … Read more

Custom post type, custom taxonomy, query posts only from taxonomy (children of)

The problem was in not reading documentation carefully enough 😉 As it stands in http://codex.wordpress.org/Class_Reference/WP_Query in ‘tax_query’ part, “tax_query takes an array of tax query arguments arrays” so the correct part of code would be: $query_args = array( ‘post_type’ => ‘portfolio-type’, ‘paged’ => $paged, ‘tax_query’ => array( array( ‘taxonomy’ => ‘portfolio-category’, ‘field’ => ‘id’, ‘terms’ … Read more