I’m not sure this is the best way but it works:
//First get all child categories if 'big_corporates'
$categories = $args = array(
'parent' => $big_corporates_ID,
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 1,
'taxonomy' => 'projects_category'
);
//then loop over them and get the first post of each:
echo '<ul>';
foreach ($categories as $category) {
$projects = get_posts(array('numberposts' => 1, 'post_type' => 'projects', 'projects_category' => $category->slug));
foreach( $projects as $project ) {
setup_postdata($project);
?><li><?php echo $category->name; ?> - <a href="https://wordpress.stackexchange.com/questions/22711/<?php the_permalink(); ?>"><?php the_title(); ?></a></li><?php
}
}
echo '</ul>';
Related Posts:
- get_posts assigned to a specific custom taxonomy term, and not the term’s children
- Get term SLUG by term ID
- Get posts from taxonomy URL
- Simple Filter between multiple taxonomys
- Custom Taxonomy with tax_query
- How to get posts that contain multiple terms from multiple taxonomies?
- URL rewriting taxonomy term
- Orderby taxonomy term id using get_posts not working
- Get Posts by tag from a custom taxonomy
- get_the_term_list without links in 3.1
- Custom columns on edit-tags.php main page
- get_term_children for immediate children only (not grandchildren)
- Custom taxonomies capabilities
- Can’t get a custom template taxonomy page to display
- Creating a non-removable taxonomy term
- Can I turn off write-in tags/taxonomies?
- Is it possible to use one slug for Multiple Taxonomies?
- Is it possible to add taxonomies to user profiles?
- Get terms from multiple taxonomies
- Using tax_query creates a 1 = 0 or 1 = 1 in $wp_query->request
- How to restrict on selecting child taxonomy
- How can I set a default listing order on the admin page for a custom taxonomy? (without plugins)
- Is it possible to sort the post based on a custom field?
- How do I get terms as a list for a specific post?
- get taxonomy terms for parent and child
- On Taxonomy Template page, want to add Post_Type
- Separator for multiple terms
- The next_posts_link() show me a aditional page in blank
- Help building array hierarchically with taxonomies (to get posts)
- Removing the base “Author” or changing it to something else. is it possible?
- What are terms and taxonomy, how they related to post and how these three are stored in database?
- Get multiple term objects by ids
- Echo custom taxonomy term name
- Next and Previous links on a single taxonomy page only link to same term
- Why does WP rename similar “term name”-slugs in separate taxonomies?
- Move terms from one taxonomy to another keeping the hierarchy
- How can I get WP to build a feed based on multiple taxonomy terms
- Get custom taxonomy description with paragraph tags
- Getting the selected terms for custom taxonomies in the editor
- Change permalink of post if it belongs to custom taxonomy
- Get pages only with a specific taxonomy
- Set custom post type terms by id without knowing taxonomy
- How to determine the depth of a term in a custom taxonomy?
- How do I Use Multiple Loops with WP_Query?
- $wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?
- How to obtain the link/URL to the feed of a custom taxonomy?
- get_term_children doesn’t return an array of children terms
- Term count by user
- Catchable fatal error on custom category post
- How to add contents of a custom field to a taxonomy term list?
- Google Map Shortcode for Custom Taxonomy/Post Types
- Querying two taxonomies
- How to target parent product category and its children using WooCommerce?
- Custom taxonomy query is empty. 0 = 1 in SQL
- How do you reorder the custom taxonomies on the right side of a custom post edit page?
- Query posts by taxonomy with current term
- Custom Taxonomies not retaining hierarchy while importing from one site to another
- What is the most efficient way of implementing a notification system? [closed]
- Remove custom taxonomy column from my custom post type columns
- Check if custom taxonomy has posts with get_categories()
- How to add images to taxonomy terms? [duplicate]
- Echo custom taxonomy slug
- Remove a href from this code
- Adding a second custom taxonomy to a custom post type (both shown in its table)?
- custom post type, hide or disable the status line in publish meta box
- Get post terms from multiple custom taxonomies
- Terms Per Page in custom taxonomy Admin
- How to get attached image to taxonomy..?
- How to get posts by category and by choosing a taxonomy term?
- How to get list of only custom taxonomies?
- Disable a Custom Taxonomies default save mechanism
- Replicate Drupal form options as taxonomies?
- Multiple Drop-Down custom taxonomies search
- How to combine taxonomies into URL?
- Issue adding custom taxonomies to custom post type (PHP)
- Taxonomy URL rewrite whilst keeping filtered posts?
- Add terms to a taxonomy archive from within the same taxonomy
- Fill New Taxonomies
- True or F False Setting of ‘with_front’ Parameter of Rewrite Is returning Exact Same result
- How do I show the parent term on a custom taxonomy template (not the ID)?
- Filter “get_terms” query
- Display taxonomies for custom post type
- Custom Taxonomy – Dropdown
- How to show selected check box vendors on front end home page?
- Error 404 in Custom taxonomy with pagination
- Need help understanding a rewrite with multi-level taxonomy
- custom taxonomy don’t return a value
- Change Permalink to Value of Custom Field
- Where to put a migration script to switch post information?
- Gravity prerender taxonomy [closed]
- Advanced search: roles and multiple taxonomies
- One taxonomy template for all categories?
- Get post terms with hierarchical relationships
- Removing fields from category/taxonomy edit form
- Error in Custom Taxonomy UI
- Remove ‘portfolio’ from URL
- is_tax not working for custom taxonomy
- wp_add_object_terms cant recognize a post ID
- Foreach for get_the_terms for hierarchical taxonomy don’t repeat Top Level Terms if contains multiple Second Level Terms
- Gravity Forms with Advanced Post Creation Add-On not updating ACF fields on custom taxonomy