Post loop count is not in order

a) Try to initialize the $count variable before your loop: $counts=0; $loop = new WP_Query( array( ‘post_type’ => ‘focus-areas’, ‘posts_per_page’ => -1 ) ); while ( $loop->have_posts() ) : $loop->the_post(); $counts++; echo $counts; echo ” – “; endwhile; b) or use the current_post method (starts at 0) of WP_Query: $loop = new WP_Query( array( ‘post_type’ … Read more

Display custom taxonomy on my custom post type

If you’re using a custom taxonomy, you can’t use the_category() — that’s reserved for the default WordPress category taxonomy. Instead use the_terms(): <span class=”itemCategory”> <span class=”icon-folder-close”></span> <?php echo __( ‘Published in ‘, THEMENAME );?> </span> <?php the_terms( $post->ID, ‘status’, ”, “, “, ” ); should output the status taxonomy for your post. Reference the_terms() Taxonomies

Add tags to custom post type without menu link

To remove the submenu Tags link from the admin menu, you might try add_action( ‘admin_menu’, ‘custom_admin_menu’ ); function custom_admin_menu() { // debug to find the correct submenu slug: // global $submenu; // print_r($submenu); $menu_slug = ‘edit.php?post_type=infographics’; $submenu_slug = ‘edit-tags.php?taxonomy=post_tag&amp;post_type=infographics’; remove_submenu_page( $menu_slug, $submenu_slug ); } if your custom post type is infograhpics. By viewing the global … Read more

post-per-page and offset not working

Your query args are messed up. Posts per page and offset params are not part of the tax_query array. Check out the example in the Codex: $args = array( ‘post_type’ => array(‘your_cpt’), ‘posts_per_page’ => 3, ‘offset’ => 3, ‘tax_query’ => array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘brands’, ‘terms’ => array(‘iHOME’), ‘field’ => ‘slug’, ) … Read more

Add “Select All” to custom taxonomy

You don’t have to rebuild the metabox… you can just add a pseudo term via the get_terms filter. This will add an “All Terms” term to your checkbox list, (assuming a hierarchical taxonomy). add_filter( ‘get_terms’, ‘wpa104168_all_terms’, 10, 3 ); function wpa104168_all_terms ( $terms, $taxonomies, $args ){ if ( is_admin() && function_exists( ‘get_current_screen’ ) && ! … Read more