The page
itself is a custom post type, you can notice this when you open the edit page screen. Your URL will be like this:
www.example.com/wp-admin/edit.php?post_type=page
This means you are on a page
post type.
Now about your code, the first condition of your conditional determines if you are on a page
post type or not. In the else
section, you can also set the post_type
as an argument:
$childpages = wp_list_pages( 'post_type=essay&sort_column=menu_order&title_li=&child_of=" . $post->ID . "&echo=0' );
However, you have to have the hierarchical set to true while registering your custom taxonomy:
'hierarchical'=> true,
Take a look at this question, which has some valuable information about this. The related page from the code reference can also be useful.
Related Posts:
- List of child custom post types lists all custom post types
- Display a list of sub-pages of Custom Post Type Parent Page
- Where to put my code: plugin or functions.php?
- Create a shortcode to display custom post types with a specific taxonomy
- How To Limit Hierarchical Pages Depth (For Custom Post Types) To Children Only
- Automatically create child pages when saving a (parent) page
- Display a list of child posts on parent posts of a custom post type
- Display custom post type with shortcode
- 404 on child page when parent page slug is identical to custom post type
- Add Content to Page without shortcodes
- Create child page within custom post type
- Custom Post Type Permalink For Parent/Child, 404 Page Not Found Error
- How can I fix those issues generated by the Themecheck plugin
- Shortcode Displaying Custom Post Types
- Child pages on hierarchical Custom Post Types 404s
- WordPress Custom Shortcode Conflicting with Media Library
- Can a shortcode included in post content add styles to the ?
- How to retrieve category of a post in have_post loop?
- Checking if looped item has a parent inside a shortcode
- get_post_meta is not working inside shortcode
- the_post() is printing titles in page footer
- Redirect to first child on Custom Post Type (without template)
- Add custom attributes to a post
- Shortcode leaves no space for other elements?
- How can I add a shortcode to query Custom Post Type with ACF in WordPress?
- Custom shortcode works in Elementor editor but not on frontend
- Get Posts by Category, Tag , and CPT Taxonomy
- post_type internal ID?
- Custom post type Shortcodes wordpress
- how to create custom post type with dynamic category_name using shortcode
- Add shortcode inside of the_content()
- WordPress Custom Post Type and Shortcode for Portfolio Items
- Run shortcode in custom script in wp_head if post type is CPT ‘Jobs’
- Query to get child pages of current page and display it in action hook
- Creating shortcode id for custom post types
- Shortcode is displaying the content on top of the page [duplicate]
- Filter content in shortcode
- Shortcode with WP_Query more than once on one page
- posts within custom post type all share the same content in the front-end
- Shortcode to return single custom post based on post taxonomy
- How do I display child post types in the parent post type template
- Change post type depending on shortcode
- Custom Post Type for Shortcode Use – Prevent it display as a post (with slug)
- How to call a post’s metadata in shortcode.php?
- Looking to Customize YouTube Video Embeds
- Trying to write shortcode with get_post_meta but isn’t working
- List child categories from parent category on custom taxonomy page
- Shortcode / WP_Query in post changes context
- How to display class name in this shortcode post query
- Custom Post Type or Shortcode, What to choose? [closed]
- Modify a plugin function output from another plugin
- Problems making shortcode with custom post types and taxonomy
- Using Custom Post Meta Values in Shortcode
- Why is my custom post query shortcode only showing 1 post?
- display custom portfolio tags
- Content in WP Editor displayed below CPT shortcode [duplicate]
- Only looping through pages that have children or subpages
- How do I output a list of a specific post type in a table?
- If/Else child list for Custom Post Type single template within loop?
- Shortcode in pages or tempate files for custom post type
- How to make post templates to include shortcodes only?
- Migrate Custom Post Type with Custom Fields data and parent child order
- Get Posts List of Current Selected Custom Taxonomy in Shortcode
- php dynamic content inside shortcode
- How to show Custom Post Type – Case Study using Shortcode & ACF
- Alike Shortcode using in Custom Shortcode
- Show in an entry a Custom Post Type associated to a post
- Create a CPT to edit Shortcodes Atts
- Query to Exclude Child Pages from Custom Post Type Archive
- check if current page is a child of a specified top level page
- Display CPT Category List as Shortcode
- Can Someone help me to create Short Code for displaying a category posts
- Shortcode with loop stacks output
- Custom post type shortcode
- background featured image display using shortcode
- How to display the post using a shortcode in WordPress?
- How can I use javascript in specific posts without relying on a plugin?
- How do I find out which (page) template file my custom child post is looking for?
- WordPress shortcode to pull product post data
- How to generate auto shortcode for custom post type same as Elementor Template?
- Why can’t I filter my CPT shortcode by category?
- From CPT Custom Loop into Shortcode?
- editing shortcode for custom post type within a plugin
- Button link display in shortcodes using custom field in ACF
- Custom Post type shortcodes
- Custom post type shortcode with taxonomy attribute not working and no errors
- How to use POST method using custom wordpress button?
- Shortcode and get_template_part
- WordPress post not executing shortcode until updated
- Display Custom Post Type Archive content with Shortcode
- Standard Page Child of CPT Not Found (404)
- Load custom post type with ID in a shortcode
- How to seperate posts by categories?
- Do not parse shortcode in CPT
- I have a problem with displaying children pages of custom post type
- Custom post type loop without children
- Shortcode in excerpt
- Extracting Post ID and passing through as an attribute in a shortcode
- Enable shortcodes on custom post type
- Custom meta box in editor of custom post type not working