New answers tagged

0

Has your custom post type created with the categories? if yes just add 'post_type'=> 'your-custom-post-type' in the args. So for you it will be as below: $args=array( 'post_type'=> 'Ürünler' 'showposts' => -1, 'category__in' => array($category->term_id), 'caller_get_posts'=>1 );


1

If you are looking for specific term objects from the term slugs, from a specific taxonomy, I think new WP_Term_Query() is your best bet: $term_args = array( 'taxonomy' => 'category', 'name' => array( 'accessibility','wcag', 'abc' ) 'hide_empty' => false, 'fields' => 'all', 'count' => true, ); $term_query = new WP_Term_Query($...


0

get_categories doesn't allow you to set rand as orderby AFAIR, but that's not a big deal. It returns an array, so in your case all you have to do is to shuffle that array: <?php $categories = get_categories( array( 'orderby' => 'name', 'order' => 'ASC', 'exclude' => 'all', 'include' => '135,19,124,133,126', ...


0

I found a custom solution, this is the function : function get_all_categories_linked_to_post_type( $post_type ) { $a_terms = array(); $the_query = get_posts_by_type($post_type); if( !empty( $the_query->posts ) ) { foreach ($the_query->posts as $post) { $terms = wp_get_post_terms($post->ID, 'category'); if(...


Top 50 recent answers are included