How to Create a Template for a WordPress Custom Post Type
WordPress picks a custom post type template by file name. Learn the hierarchy path, the classic single and archive files, and the block-theme Site Editor route.
Resources
Step-by-step guides to building, running and maintaining WordPress sites.
WordPress picks a custom post type template by file name. Learn the hierarchy path, the classic single and archive files, and the block-theme Site Editor route.
Creating a WordPress custom post type answers a problem that turns up in nearly every client project: content that belongs to neither a post nor a page. A property listing, a staff profile, a case study, a downloadable specification; each one carries its own fields, its own archive, and its own editing screen, and each […]
A WordPress shortcode is a bracketed tag, something like [ gallery ] or [ contact-form-7 ], that WordPress swaps for dynamic content the moment a page loads. Adding one is a matter of placement, not programming. Almost every shortcode worth using already exists: it ships in WordPress core, comes with a plugin, or is bundled […]
Creating a custom shortcode in WordPress means building a short bracketed tag that outputs dynamic content wherever it is placed. The tag itself is tiny. What it produces (a formatted call-to-action, a list of recent posts, a pricing table pulled from live data) can be as involved as the logic behind it demands. A custom […]
Import content into a WordPress custom post type, then export it with postmeta and media. Convert existing posts and unregister the type without deleting its entries.
Restrict a custom post type to a user role in WordPress by mapping its capabilities to a custom role. Covers map_meta_cap and private-by-default entries.
Add a custom meta box to a WordPress custom post type with add_meta_box(): hook the call, set the screen to your post type, and store the fields on save_post.
Register a custom post type in WordPress with register_post_type(): set the key, labels, supports, hierarchy and visibility, hook it to init and flush rewrites.
Learn how WordPress custom fields work as native post_meta rows. Enable the panel, add a field, get and display values with get_post_meta() in a theme template.