I’m attempting to do a main listings page with everyone in the directory sorted alphabetically under the Category.
Similar to this page: http://www.health-first.org/physician/hfmg_list.cfm
Now what I’ve done is run a query for posts within the WPBDP_POST_TYPE. The Categories for BDP is different than the stock wordpress Categories so I can’t use $args to establish categories, correct? What I’ve done is below but I’m afraid if I have to run Queries for each category it’ll slow the page down. Is there a better way to do this or a command within BDP I’ve missed?
An example of what I’ve done to pull the ones that are in “category 5”.
$args = array( 'post_type' => WPBDP_POST_TYPE, 'orderby' => 'title', 'order' => 'ASC' ); <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <?php $value = wp_get_object_terms( $id, WPBDP_CATEGORY_TAX, array( 'fields' => 'ids' ) ); ?> <?php if(in_array("5", $value)): ?> <p><a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a></p> <?php endif; ?> <?php endwhile; ?> <?php endif; ?> <?php wp_reset_query(); ?>
- The topic ‘List Titles under Categories’ is closed to new replies.