The answer is essentially in Codex!
<h2>Recent Posts</h2>
<ul>
<?php
$recent_posts = wp_get_recent_posts(array('post_type'=>'book'));
foreach( $recent_posts as $recent ){
echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' . $recent["post_title"].'</a> </li> ';
}
?>
</ul>
The only thing I did was add an argument to search for the book
post type instead of the default post
type.
And this is probably a duplicate of this question anyway, but the system won’t let me mark it as such.
Related Posts:
- Getting custom taxonomy from custom post type
- What should I use – Taxonomies, custom fields, Post Type?
- How to modify URL structures in custom post types and taxonomies or terms
- Custom Comment Types
- Not Able to Insert Taxonomy Term Using wp_insert_post()
- Restrict taxonomy dropdown to post type
- Integrating an interactive map into a WordPress custom post type
- Pages, Custom Posts & Custom Taxonomy defining slug structure
- How to rewrite custom post type URL for multiple depths instead of one specific depth
- How to show a tag archive of one post type only
- Conditional two level dropdown filter for custom post type
- Custom Taxonomy archive returns 404
- Custom edit post column – category not showing
- Custom Post Type: How to display all of same taxonomy?
- Create Custom Post Type Archive Page with Sub Categories Navigation Sidebar
- WordPress import not importing custom taxonomy
- Is there any performance consideration when using Custom Post Types?
- Taxonomy structure of Sport site
- Custom post type custom taxonomy archive page name
- Querying Term Posts in Loop
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- How can I move a custom taxonomy and its data from one post type to another?
- Permalinks not working for custom taxonomy on custom post type
- Show listings from Impress Listing plugin in random order using taxonomy and terms
- Custom taxonomy in custom post RSS feed
- How to display product subcategories into my custom post type single page
- Get next and previous 3 posts in a term in single post page
- Custom post type templating problem
- Custom Taxonomies not appearing in Admin
- Conditional Statement custom post type category
- redirecting improperly after updating custom taxonomy term when referring from CPT edit page
- Which post does a taxonomy term belongs to?
- custom types taxonomy hide_empty
- Custom Post Type – No Results Found
- 404 error when navigating to a taxonomy page with Cyrillic, what’s wrong?
- How to rewrite url for any specific taxonomy?
- Custom post URL 404 error
- WordPress Doesn’t Generate Taxonomy Archive
- How do I require the specification of term in a custom post type and custom taxonomy?
- CPT’s with landing page instead of archive – Url Rewrite?
- How to make front end form only accept certain values
- How to produce a sub-page-system in WordPress
- WordPress custom taxonomy template not working
- Custom Taxonomy not displaying all post
- How to Display Posts From Category Within a Custom Taxonomy?
- Custom Permalinks For CPT and pages with parent. Advanced WordPress
- Iterating through Object Array to customise display of full custom taxonomy for custom post type
- When I choose category from dropdown then everything working fine.But in backend it checked only child not parent [closed]
- Removing numerous Meta boxes from numerous CPTs
- How to rewrite the post slug of a custom post type post
- Exclude latest post from WP_Query taxonomy term loop
- Getting List of child terms from custom taxonomy parent
- How can I get 3 different taxonomy type terms in a div class element?
- Function to erase every post from a taxonomy
- Get terms for a specfic post from multiple taxonomies in custom post type
- Is it possible to have hierarchical taxonomy and hierarchical custom post types in one permalink?
- Custom Post Type URL doesn’t work anymore
- using custom taxonomies with custom post types: display list of posts by ‘category’
- How to get post count of specific taxonomy that have store name & category
- display post count in archive page that have relation with another taxonomy term
- Show Custom Post Type based on Category on Archive Page
- Get all posts for custom taxonomy term
- Permalinks: custom post type -> custom taxonomy -> custom sub taxonomy -> post
- posts_per_page is not working by term
- Filter Custom Post Type Posts by Taxonomy
- How to display only child category post in related posts in custom post type?
- Pretty Permalinks with CTP and Taxonomies / Hierarchical
- % encoded URL giving 404 error in WordPress
- CPT: multiple loops with different terms
- Specific template for subcategory of custom taxomy
- Automatically add CPT UI categories to the menu
- Custom category taxonomy – archive page not showing up
- Custom post type URL structure with site.com/custom_taxonomy_slug/post_name
- Custom taxonomy archive slug overwrites static page
- Slugs on hierarchical taxonomies
- Group based routing and administration
- Adding Custom Taxonomy Along-with Post Name in Post Type Permalink
- I want to display my custom post type arranged by taxonomy
- WordPress query posts by custom post type not workng
- Get posts of an specific term of a custom taxonomy
- I have a custom taxonomy assigned to two post types. How do I create URLs for different term archives for each post type?
- Display posts grouped by post type in taxonomy.php
- Advice on Categorization for a Custom Post Type
- Multiple post types or single post type with category taxonomy?
- Add a meta to custom post type which corresponds to a particular taxonomy
- Get custom taxonomy name from custom post
- Custom taxonomy archive is visible to only subscibed users
- How to List CPTs Under One Tax Term
- custom post type and taxonomy URL
- custom post type and taxonomies in a php class
- Adding 2 CPT with multiple custom taxonomies to permalinks
- custom taxonomies are not showing up in get_taxonomies
- Custom filtering on month value only of an entire date field
- Displaying or Hiding Metadata on Page from WP CPanel
- Invalid Taxonomy in template
- Get only one custom post from each category
- How can I show second most recent post in sidebar, if most recent post is open in the browser?
- Get term link of shared taxonomy between multiple post types
- Custom post type with custom taxonomies structure url not working archive of CPT
- Make term slugs of custom taxonomy available in WP REST API for custom post type?