You can use rewrite endpoints to achieve this.
First, register your endpoints:
function wpa_movie_endpoints() {
add_rewrite_endpoint( 'synopsis', EP_PERMALINK );
add_rewrite_endpoint( 'screens', EP_PERMALINK );
add_rewrite_endpoint( 'trailer', EP_PERMALINK );
}
add_action( 'init', 'wpa_movie_endpoints' );
So now in addition to http://domain.com/post-name/
(or whatever your particular permalink structure is), you’ll have:
http://domain.com/post-name/synopsis/
http://domain.com/post-name/screens/
http://domain.com/post-name/trailer/
You can then check for the existence of these query vars in a template action, or in the template itself, and show the appropriate content:
global $wp_query; // may be necessary, depending on where you're using this
if( array_key_exists( 'synopsis', $wp_query->query_vars ) ){
echo 'show synopsis!';
}
Related Posts:
- WP_Query Pagination on single-custom.php
- Restrict custom post type to only site administrator role
- How to force one column layout on custom post type edit page?
- WordPress REST Create Post of Custom Type
- Limit the post for differents custom post type in the same wp_query
- Custom Posts on Different Pages
- Newer/Older posts links display same posts on every page
- taxonomy list display custom post count
- automatically create taxonomy with same name as post title
- Wp-query causing problems with the_content();
- Custom Post Type by user
- saving custom post type data to different table in wordpress
- How to create posts (not post template) to be displayed on projects page?
- Display “Post 2 of 4” on single post page?
- Query post types with multiple keys
- same archive template for different custom post
- When viewing single parent post, display list of children
- Limit Authors to their Own Posts on front-end excluding admins
- How to make post sticky in the admin page?
- How can I show a custom post type for users in the authors.php file?
- Blog page showing same content as homepage
- Auto-generated posts not showing in backend (but being counted!)
- Need help targeting a custom post type with conditional tags
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- Show the same Article Available in Other Categories
- Show custom post type filtered by category
- Display random posts, but omit the post it is on?
- Disable block with taxonomies at post page
- Get latest 3 posts from multiple CPT in one query
- Meta query for custom post type ignored in main query
- Hiding posts by other users and non-logged in
- Get related posts of child term of custom post type
- Update postmeta Parent when post_status child change
- 2 Different Custom Post Types in Submenu
- How to assign classes to all elements?
- How can I show 1 featured post in a styled element, and the next few below differently styled
- Reworking function for counting custom post type posts count
- wp_insert_post wrong post type [closed]
- Can I change my post type to anything and my site still work?
- How to Display Posts From Category Within a Custom Taxonomy?
- Published post auto change status to pending after 90 days
- display posts of custom post type with custom taxonomy
- Automatically update slug with latest title within custom post type [duplicate]
- How to Query in WordPress which shows Alphabetic Posts?
- Post Query not working
- How to filter url on post submission?
- Different structure/content for posts from a custom post type
- creating files for displaying different custom post type posts with paging
- is it possible in a custom post, create custom fields as well whitin?
- custom taxonomy listing returns no posts
- How to controll the Posts post type and general wondering about WP data structure
- Display author box on just certain category posts?
- How to fetch posts that are stored in the different table than (default) wp_posts?
- Am I mixing up the concept of posts pages and categories?
- Display custom post counts for author , not default posts
- Building a Data Intensive Website with WordPress
- If/Else child list for Custom Post Type single template within loop?
- redirect after submiting post for review
- Display all Categories except ones with a specific parent
- How to achieve a multi-taxomony layout with posts?
- i need to have a tab with gategory post
- Custom Post type to Woocommerce Product type
- How we can create menu from Appearance > Menu and use as a add-submenu-page for admin menu?
- Enforcing a rigid reusable template structure for similar posts?
- Auto delete pages/posts without views
- WordPress retrieving $post based on random key in $_POST
- minimize wp_query call to database
- Post display in separate page [duplicate]
- User Archive page for Custom Post Type – Pagination Issue
- Limit posts per page depending on the size of a div?
- Delete Post by User
- Custom post Query and WordPress Post Query Clash
- Setting up a page to house certain types of posts
- Multiple Custom Post Type with different Taxonomies
- Links Image in “Catalog” Page to Posts
- Only show current category post
- WordPress Contents Migration
- Filter By Term Not Working – Custom Post Type
- Problem to get the link of the default ‘post’ post type like the orther custom types
- how to display notifications in the wordpress menu when a new post is published
- Editor role isn’t seeing specific post type posts with only post_type parameter
- Featured image in custom post is being disabled
- How to set class to “current-page” on the currently viewed single post within a CPT
- Getting wrong ID
- How can draft post after 1 year
- How to make post page unique and show it on home page?
- How to create content automatically when a post is published?
- query_post causes the posts to be loaded twice on load more posts
- Query Only Show Text on Posts With Certain Taxonomy Tag
- Retrieving IDs of child pages which are in a different post type
- Query Posts From Multiple Post Types
- WP Build-In Post selector for CPT
- post in a lightbox?
- How to make a template for a specific post of a custom post type?
- How to hide home title on pages and posts?
- How do I hide single category post on my post page
- Front end post or photo or both
- Can WordPress show posts based on a button that the user clicked 2 pages back?
- Two pagination in one page without AJAX
- Change post-name when inserting new Post if Specific Category is selected in WP