Taxonomy Url with Custom post type prefix re-write rule

Try changing the $args you are passing into the register_taxonomy method so that rewrite -> slug includes the development tag $args = array( ‘labels’ => $labels, ‘public’ => true, ‘show_in_nav_menus’ => false, ‘show_ui’ => true, ‘hierarchical’ => true, ‘supports’ => array(‘title’, ‘editor’, ‘excerpt’, ‘thumbnail’), ‘rewrite’ => array(‘slug’ => ‘development/section’, ‘with_front’ => true, ‘hierarchical’ => true), … Read more

get_categories() for only CPT

You should use wp_get_post_terms() instead of get_categories(). It returns an array of terms associated with a post. <?php function get_my_custom_terms() { global $post; $myterms = wp_get_post_terms($post->ID, ‘location’); if ($myterms) { foreach($myterms as $term) { $termname = $term->name; $term_link = get_term_link( $term->slug, ‘location’ ); if( is_wp_error( $term_link ) ) { $termlink = $term_link; } else { … Read more

Get ID and slug from taxonomy object

It sounds like you’re looking for the get_term_link() function. Your code will look something like this: <?php $catid = get_sub_field(‘selected_category’); $term_link = get_term_link( intval( $catid ), ‘product_cat’ ); ?> <h4><a href=”https://wordpress.stackexchange.com/questions/95584/<?php echo esc_url( $term_link ); ?>”><?php the_sub_field(‘title’); ?></a></h4> As you can see, get_term_link() takes two argument, the term and taxonomy. If you’re saving the term … Read more

Display Custom Taxonomy

Use the_terms(): the_terms( $id, $taxonomy, $before=””, $sep = ‘, ‘, $after=”” ) So in your loop: if ( ‘radio-shows’ === get_post_type() ) { the_terms( get_the_ID(), ‘genre’ ); the_terms( get_the_ID(), ‘instruments’ ); } else { the_category(); the_tags(); }

Extending wordpress search to include excerpts and taxonomies?

With WordPress 4.2.2 I’m using the following (admittedly fragile) method to search excerpts as well as the content and title without a plugin. This is the relevant snippet from functions.php. add_filter(‘posts_where’, ‘custom_posts_where’); function custom_posts_where($where) { if (is_search()) { $where = preg_replace( “/(\w+).post_title LIKE (‘%.*?%’)/”, “$1.post_title LIKE $2) OR ($1.post_excerpt LIKE $2”, $where); } return $where; … Read more