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?
- Get url.com/post_type/taxonomy/term work!
- Displaying custom-taxonomy-terms sorted by parent/child-hierarchy?
- Invalid argument supplied in register_taxonomy $args->taxonomies
- set permalink for CPT
- Top Level pages in wordpress giving 404, but child pages working fine
- Sitemap generation
- Plugin fatal error
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- Taxonomy/Custom post type structure suggestion on a movie site
- Search by tag name and category
- Taxonomy in URL
- Ordering values entered in Custom Taxonomies
- Listing all term items alphabetically / sorting loop
- How to produce a sub-page-system in WordPress
- Change the Custom Taxonomy URL Slug pattern
- Advanced search form with filters for custom taxonomies
- Custom taxonomy and post type with same slug
- Losing Nav Active State in Menu
- WordPress custom taxonomy template not working
- dropdowboxes with pre-selected custom fields optios that filters the results according seach needs
- Listing custom terms in custom post meta
- Show fields based on taxonomy selection in editor
- Display related custom taxonomy posts in sidebar
- WordPress subpages to custom post types
- Different rewrite rules for taxonomies and cp in multisite?
- Permalinks: custom structure for taxonomy – tags?
- count results in search page based on custom category
- Custom permalink with child taxonomy terms
- Assign Custom post to Custom Taxonomy
- Custom post type Permalinks with hierarchical Taxonomies
- Display Registered Taxonomies
- How can I get this request to use the Custom Post Type page template instead?
- Include custom taxonomy term in search
- Show custom post type inside a custom post type
- Only show posts with date of today or in the future (i.e don’t show past posts)?
- Create a permalink structure with custom taxonomies and custom post types gives 404
- Display and register custom categories for custom post types
- Why is my WP_Query outputting my entries twice?
- How to display Related Posts based on number of taxonomy terms matched
- Different Category system needed for the Custom Post Type
- Not Able To Render Single-CustomPostType.php File
- Custom Post Type Category Link
- Retrieve custom post types by custom taxonomies with WP_Query
- Custom Post type category pages template and loop
- Archive for a Taxonomy of a Custom Post type
- Three Most Recent Posts, One Per Term
- Check if post has specific tag_ID in custom post type
- How to get WordPress term attached to the Post?
- Query posts with double taxonomy
- Custom Post Archive is not working
- Custom post type pagination 404
- get_the_title() is returning results from previous loop
- Why cant I add a custom post type to a custom taxonomy?
- Show Custom Taxonomy title in loop
- WP the_posts() on single-cars.php get category link
- tax_query not working in template
- Trick to get custom post types to show up on a custom taxonomy page?
- Custom Taxonomy Not Showing in Front-End When Outputting a Custom Post Type with WP_Query()
- How to add custom taxonomy in custom post type permalink?
- Proper way to display latest 5 posts grouped by post type?
- single-{post_type}.php not working
- Properly flush rewrite rules on plugin activation
- Adding predefined terms to a taxonomy
- How to solve this custom post type goes to 404 page?
- Get term name without a foreach loop
- Show all tags on custom post type
- Template to list categories in custom taxonomy
- How to Set Taxonomy Object Description?
- Best way to specify “article type” in URL
- How do I add a Custom Post Type that looks and behaves exactly the same as Posts?
- custom post type vs. conditionally displaying meta boxes for specific terms?
- Is there something like has_no_term
- Getting the taxonomy
- Template files for Custom Post Type and Taxonomy
- How to make WP_Query not to show irrelevant posts?
- in_category for custom post types
- Custom Post Type Dilema – How do I categorise by country?
- How do I display a list showing custom post types nested within a taxonomy?
- Custom select query for taxonomies that have posts categorized in another taxonomy
- Custom post type’s extra fields – how to handle?
- What’s the name of the custom post type yearly archive template?
- Combine multiple getEntityRecords calls
- Pagination Not Working for Custom Taxonomy with Custom Query – 404 Error
- Get parent category id from child category page for custom taxonomy
- Trying to get custom post of a custom taxonomy
- Custom Taxonomy Is Being Pulled into a Page, But It Doesn’t Have A Hyperlink
- Querying two taxonomies with tax_query not woking
- Rename a slug label
- WordPress wp_query() basic question about args
- Loop to display custom post type from a custom Taxonomy
- Custom Post type & Taxonomy 404
- Main query not querying any posts in custom taxonomy template
- Which Template Page Should I Use?
- WordPress Custom Post Type – show only certain posts that have specific taxonomy set
- Custom Taxonomy not displaying all post
- Display posts with tag for custom post type only
- Different slug taxonomy for two different CPT
- Create an archive page for custom post type with custom taxonomy