Have you tried using get_the_terms()
?
Quick-and-dirty, from your code example:
<?php
global $post;
$terms = get_the_terms( $post->ID, 'some-term' );
foreach ($terms as $category) :
?>
<h3>More News From This Category</h3>
<ul>
<?php
$posts = get_posts('numberposts=20&category='. $category->term_id);
foreach($posts as $post) :
?>
<li><a href="https://wordpress.stackexchange.com/questions/39455/<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
<li><strong><a href="<?php echo get_category_link($category->term_id);?>" title="View all posts filed under <?php echo $category->name; ?>">ARCHIVE FOR '<?php echo $category->name; ?>' CATEGORY »</a></strong></li>
<?php endforeach; ?>
</ul>
See also: the_terms()
and get_the_term_list()
Related Posts:
- Exclude latest post from WP_Query taxonomy term loop
- How can I show second most recent post in sidebar, if most recent post is open in the browser?
- Combining Multiple Taxonomies in one URL
- Getting the Intersection of Two Custom Taxonomy Terms for a Custom Post Type?
- Why does my custom taxonomy show a total count across all post types
- ‘No pages found’ in Dashboard after registering custom taxonomy
- Custom Post Type with Nested Taxonomy and Template Files
- How to display recent posts added in custom post types
- Should unaltered default loop/query return a list of custom posts belonging to a custom taxonomy?
- 404 error PageNavi custom type taxonomy | wordpress
- Creating a function that receives the taxonomy terms that have been changed in a custom post type
- Display Custom Post Type in Recent Posts
- Query for posts in 2 taxonomies
- Custom Taxonomy Not Showing Up on Post Page
- Custom permalink – append taxonomy name and term name at the end of permalink
- Get the posttype of a taxonomy/term
- Custom Taxonomy Creates Unwanted Integer Terms on Post Save
- Add hierarchical taxonomy to permalink for custom post type
- How to get posts from multiple custom post types according to it’s custom taxonomy terms?
- get_template_part for each level of taxonomy term
- Displaying a custom post types custom taxonomy value?
- Podcast Guest List
- custom permalinks based on taxonomies for custom post type
- Update post terms with custom taxonomy
- Deleting Custom Taxonomy Term only increments tag_ID
- Get custom post type list for every category shortcode
- Custom Post Type Taxonomy Filters
- Listing tags from a custom post type
- How do I associate a custom post type with another through a taxonomy or storing an ID in a custom field?
- create a subcatagory for a custom post type and out put url as posttype/subcategory/item
- How do I display the taxonomy term alongside the post type post title?
- Get related posts of child term of custom post type
- Filter term taxonomy metabox in custom post type
- Show custom post archive when custom post not specified
- Show custom post type relationships by taxonomy
- Custom Post, set object Taxonomy terms in plugin
- Hierarchy and access control for Custom Post Types (CPT)
- Different Category system needed for the Custom Post Type
- single-{post_type}.php not working
- WordPress wp_query() basic question about args
- Loop through custom posts by taxonomy and display the titles in a list, it is repeating 8 times
- How to add current custom taxonomy slug to body class
- Custom post type, custom taxonomy, query posts only from taxonomy (children of)
- How to define a term for custom taxonomy
- Exclude posts with custom taxonomy
- List custom taxonomy as navigation – taxonomy pages with all it’s posts?
- Get parent category(taxonomy) ID from single template of a custom post type
- Dynamic CPT / Taxonomy
- How to approach a site where it has sub-businesses, each with its own pages (“articles”, “staff”)? Don’t want to use WP multisite
- How to rewrite custom taxonomy term archive to use THE SAME SLUG/front as CPT
- Get the link of the first post of a custom taxonomy in a custom taxonomy list
- Get custom term meta problem on single post type
- Creating custom post type posts and associating them with a post from another custom post type
- Different structure/content for posts from a custom post type
- Custom Post Type View Button in Admin Gives 400 Error
- Custom Post Type URL Rewrite’s
- Add term for custom taxonomy from front end
- Custom Taxonomy Filter Issues
- how to organize my categories or should I do custom post types for some?
- How do i display post from a taxonomy term?
- Multiple permalinks for a single post with multiple taxonomies
- rewrite rules hierarchical
- either single-{custom}.php 404’s OR /taxonomy/ 404’s – custom post type and taxonomy permalinks
- How do I make a request in my browser to search the CPT taxonomy?
- Archive page of taxonomy returns a 404 error
- update custom taxonomy custom fields
- Filter taxonomy by CPT
- Get dropdown child categories from parent category of custom post type
- How to display “META” array in register_taxonomy
- If ACF Post Object post has custom taxonomy term…
- I want to create a metabox under custom taxonomy
- Customise Permalink Structure For Custom Post Types
- How to filter taxonomy of a custom post type and display it in the single post type page in the back end?
- Parent and child categories with their id in drop_down in CPT
- CPT/Taxonomy/Postname permalink structure makes pagination break
- Set different posts_per_page for custom post type/taxonomy
- Custom Taxonomy not working front side Woocommerce
- Custom post type post_type_link gives “page not found” on any other custom post type
- I want to create an archive and single page for a custom taxonomy for a custom post type
- Taxonomy’s title
- Display all posts from single taxonomy term
- Creating adminable dynamic filtering on custom post type
- Best way to use Category & Custom Fields?
- Complex strcuture as CPT or taxonomy for use in woocommerce product variations [closed]
- WP_Query for CPT with filter by another WP_Query
- Get posts in same category not working
- Heirarchical URLs with CPT and custom taxonomy
- Displaying taxonomies with manage_{custom-post-type}_posts_custom_column
- Plugin Error on activating
- Permalinks when using Custom Post Type with static page for archive
- How to change permalinks to taxonomy and post type’s posts
- Paginate custom taxonomy category with wp_custom_pagination
- Custom post type post taxonomies
- Query Only Show Text on Posts With Certain Taxonomy Tag
- Custom Taxonomy Showing in WP Menu
- Storing/querying custom date data
- Custom Template Taxonomy
- How to relate one custom post type to another custom post type
- Issue On Listing Woocommerce Parent Tag List
- Links in archive not including taxonomy parameter