Custom Post type as Taxonomy
It sounds like issues should be a custom taxonomy rather than a custom post type.
It sounds like issues should be a custom taxonomy rather than a custom post type.
$labels = array( ‘name’ => _x( ‘Categories’, ‘taxonomy general name’ ), ‘singular_name’ => _x( ‘Category’, ‘taxonomy singular name’ ), ‘search_items’ => __( ‘Search Types’,’SkyDance’ ), ‘all_items’ => __( ‘All Category’,’SkyDance’ ), ‘parent_item’ => __( ‘Parent Category’,’SkyDance’ ), ‘parent_item_colon’ => __( ‘Parent Category:’,’SkyDance’ ), ‘edit_item’ => __( ‘Edit Categories’,’SkyDance’ ), ‘update_item’ => __( ‘Update Category’,’SkyDance’ ), … Read more
$terms = get_terms( ‘my_taxonomy’ ); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){ foreach ( $terms as $term ) { $all_term_meta=get_term_meta($term->term_id); } }
try with this function function get_posts_in_taxonomy($post_type, $taxonomy, $term_id, $include_children=false, $limit) { $args = [ ‘post_type’ => $post_type, ‘posts_per_page’ => $limit, ‘tax_query’ => [ [ ‘taxonomy’ => $taxonomy, ‘terms’ => $term_id, ‘include_children’ => $include_children ], ], // Rest of your arguments ]; $posts = new WP_Query( $args ); if($posts->have_posts()) { while($posts->have_posts()) { $posts->the_post(); //code todo here … Read more
There was some confusion in the original question with the terminology i used. I didn’t find a way to do what i was after but it’s to late for me to do it now.
Try taking out the ‘paged’ => $paged parameter, as it is simply returning the amount of results for that page, which seems to be set at 10. (You will need to do two separate queries – one for getting the true count, and one for displaying the posts in a paginated format.)
you need a semicolon at the end of your last line of code: echo $term_link;
I’ve recently developed a plugin that can support the custom taxonomy element of this problem. The plugin creates select boxes for each of your custom taxonomy terms and throws the results onto a custom results page (of your choosing): Advanced Custom Post Search It currently doesn’t support custom meta values if this is something you … Read more
I found the answer I was looking for as this: $sport_slug = get_query_var(‘term’);
If you are in term archive page, the taxonomy and term is actually set. You could hook wp_head to add the open graph in your functions.php: add_action( ‘wp_head’, ‘wpse_wp_head’ ); function wpse_wp_head () { //First, we check if we are in our custom taxonomy if( is_tax(‘my-custom-taxonomy’) ) { $taxonomy_slug = get_query_var( ‘taxonomy’ ); $term_slug = … Read more