How to rewrite custom taxonomy term archive to use THE SAME SLUG/front as CPT
How to rewrite custom taxonomy term archive to use THE SAME SLUG/front as CPT
How to rewrite custom taxonomy term archive to use THE SAME SLUG/front as CPT
You can do that using Custom Permalinks Plugin, you need to add a full slug manually [shows/2017/any]. It also allow you customize your permalink: [anyname/another/2017/example/slug]. You should still using this plugin, if you deactivate it, all permalinks will return to default [shows/2017/%postname%]
This is pretty straightforward using a rewrite endpoint. The first step is to set an ep_mask when you register your taxonomy, which is part of the rewrite argument. Note that it’s a constant, and should be as-is, without quotes: $args = array( ‘rewrite’ => array( ‘slug’ => ‘location’, ‘with_front’ => false, ‘ep_mask’ => EP_TAGS ), … Read more
get_the_terms( int|object $post, string $taxonomy ). Use the above function to get the terms of the taxonomy. It will return the array of terms associated with the post. Then you can use the php function $count = count( $array ). it will return the count of the terms. After getting the count use the if … Read more
Add brackets to the input names: <label><input type=”checkbox” name=”taxonomy-name[]” value=”term”>term</label> It will be automatically converted to an array: if( isset( $_GET[‘taxonomy-name’] ) ){ foreach( $_GET[‘taxonomy-name’] as $term ){ echo $term; } }
Queries (both WP_Queries and raw SQL queries) are meant to select objects matching given criteria. “One post from category and one not from category” is not a description of set of posts – it’s description of two posts coming from different sets. This means you won’t be able to select these two posts using only … Read more
Yeah sure. <?php $included_post_ids =array(); $args = array( ‘post_type’ => ‘APP_POST_TYPE’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘coupon_category’, // Taxonomy ‘field’ => ‘slug’, ‘terms’ => $tax[0]->slug, // Your category slug ), ), ); $custom_posts = get_posts( $args ); if( !empty( $custom_posts ) ){ foreach ($custom_posts as $key => $postObj) … Read more
You can use wp_get_post_terms( get_the_ID(), ‘series’ ) to obtain all terms associated with the current post. This function returns array of WP_Term objects and WP_Term has count property which can be used as condition.
Here is the code…It may help you to display layout as you wanted. Also Here I have used post type as product and taxonomy as product_cat so you must need to change that as your code. The layout looks like this http://prntscr.com/mjxvzm <?php $post_type=”product”; $taxonomy = ‘product_cat’; $terms = get_terms( array( ‘taxonomy’ => $taxonomy, ‘hide_empty’ … Read more
You can get the raw list of terms attached to a post with the get_the_terms() function. You can then use this to output their names without a link: $my_categories = get_the_terms( null, ‘my_category’ ); if ( is_array( $my_categories ) ) { foreach ( $my_categories as $my_category ) { echo $my_category->name; } } To account for … Read more