Query results: exclude post w/ specific word in title display term description
-
I am using the following code to create an index page listing all posts with the terms in a specific taxonomy:
function list_posts_by_taxonomy( $post_type, $taxonomy, $get_terms_args = array('exclude' => array(4, 15, 17, 18, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 86, 87, 88, 89)), $wp_query_args = array() ){ $tax_terms = get_terms( $taxonomy, $get_terms_args ); if( $tax_terms ){ foreach( $tax_terms as $tax_term ){ $query_args = array( 'post_type' => $post_type, "$taxonomy" => $tax_term->slug, 'post_status' => 'publish', 'posts_per_page' => -1, 'orderby'=> 'name', 'order' => 'ASC', 'ignore_sticky_posts' => true ); $query_args = wp_parse_args( $wp_query_args, $query_args ); $my_query = new WP_Query( $query_args ); if( $my_query->have_posts() ) { ?> <h2 id="<?php echo $tax_term->slug; ?>" class="tax_term-heading"><?php echo $tax_term->name; ?></h2> <ol class="taxonomy-list"> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <li class="<?php my_post_class(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li> <?php endwhile; ?> </ol> <?php } wp_reset_query(); } } }
I have two issues:
(1) I wish to exclude all posts with the word “Series” in the title from inclusion in my index.
(2) For those posts that are tagged with a term in the “series” taxonomy, I wish to display the series term’s description next to the post’s title. (If you’re curious, I’ve included a link to what is essentially each series’ table of contents in the term descriptions.)
Advice on either of these topics would be greatly appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Query results: exclude post w/ specific word in title display term description’ is closed to new replies.