You should use get_posts
function.
global $post;
$parent_id = $post->ID;
$children = get_posts(array(
'post_parent' => $parent_id,
'fields' => 'ids'
));
$string = '<ul><li>' . implode('</li><li>', $children) . '</li></ul>';
Related Posts:
- Need help with adding templates (archives and sitemap) to WordPress child theme
- How to move page templates to custom folder?
- Is it possible to manipulate the list of page templates?
- Returning Variables back into a template
- Where is the correct place(s) in twentysixteen’s header.php to add a Google webfont?
- Add theme templates for child categories into the template hierarchy
- Where can I access my custom page template?
- Disable front-page.php template
- Load child template based on parent
- Override template file i subfolders
- Single Page theme [closed]
- Injecting a custom sql query into a page/theme
- How to override p2 breathe theme plugin in content template file?
- Move default page templates to sub directory
- Load sidebar template just once to prevent multiple animations
- Why still output /wp-content/themes/twentynineteen?
- Modify available templates (in dropdown)
- Templates dropdown not appearing using _s theme (underscores)
- How to show metabox on page if it is using a template
- Template for front page (latest posts)
- Child theme in separate WordPress Install
- Create a variable with string, array or multiple values
- Why WordPress gets old templates code instead of the last updated ones
- What is the point of using the front-page.php template? [closed]
- WooCommerce shop page to use my custom template [closed]
- Hide a div that is part of all pages on one specific page
- Adding Action Hooks In Parent Theme For Easier Child Theme Customization
- How can I get wp_head() as a string instead of echoing it?
- Why does my short code get executed before other content?
- Add colors to existing color palette without replacing it
- How can I see what template parts are being called for rendering the viewable page?
- Modifying JS files in Child-theme
- How to override BuddyPress 3.0 bp-nouveau theme files?
- Setting hero/splash section as a blog post
- Can a child theme based on Starker theme be released as free to use theme for public use?
- Switching between custom templates in a post type of the admin menu
- Changing order title and featured image in blog post (Astra theme)
- Loading files for theme and child theme (Require)
- New template, where to place CSS?
- get_query_var() and permalinks
- Toggle Sidebar Display
- Move theme templates to subfolder without losing page associations
- How to remove a file included in parent theme with locate_template() via child theme?
- Can’t override template file in child theme
- Why are theme templates organized as multiple point of entry PHP files instead of reusing your theme’s index.php?
- WordPress page templates in a directory
- get_page_template returning nothing
- Can Page Templates be Applied to Archive and Post Templates?
- Custom metabox for custom page template
- Include Parent functions.php in Child Theme functions.php
- Do i need to keep all the default WP templates files in a theme?
- how to display search term in the template full site editor
- How to first edit in local WordPress editor on page and the add code?
- Custom Field created in add_meta_boxes reappearing itself again in the default Custom Metabox
- How to display all subpages and short by year
- How to create a custom page(not a template) in a theme
- Can´t access child theme´s scripts dependencies found in parent
- how to setup custom content structures
- Is it possible to make *.js and folders visible in theme-editor
- add_filter to parent theme helper class function from child theme
- How can I conditionally show different home page templates based on whether or not the user is logged in?
- filemtime(): stat failed warning within a child theme
- How can I override a require() used in functions.php of parent theme to my child theme
- Using a starter theme vs starter theme with child theme
- Unique design inside a specific category’s url
- Simple child theme modification but links are broken
- Hestia Child theme creation
- Alignment Problem [closed]
- Avada Child Theme Development
- What $handle does WordPress use for a theme’s implicit style.css?
- Editing my theme to try to place the default header at the top of the page breaks the rest of the page content
- Shortcode call not working in WP Template
- Create theme for mobile phones and tablets only?
- How to create a WP theme that use BootStrap? [closed]
- Custom theme template files
- How to differentiate the homepage structure from the category page structure in WordPress template?
- How to modify theme content in Thematic?
- ACF get_sub_field ALT TAG in the repeater doesn’t show
- Why front-page.php doesn’t show content of file instead shows loop
- Theme functions don’t work as expected in partial included via get_template_part() after custom query using Ajax [duplicate]
- Copying a modified theme from one wordpress site to another wordpress site [closed]
- How can I access variables from theme in child theme? [closed]
- Show Yoast SEO meta tags in Custom WordPress Templates (Theme)
- (Parent) theme Is Not Showing In Theme Selection Panel and Therefore Breaks Child Theme
- How can I fix my theme header for my CSS stylesheet?
- how can I re-utilize and class on a child theme
- Can you create a custom page with content in the center already defined?
- How to migrate the menu from the site on my own theme in WordPress?
- Problem with multiple menus in theme
- Having some trouble properly displaying Custom Post Types in templates
- Enable WP to accept standard jQuery code embeding between the tags [duplicate]
- Extending arrays in parent theme without completely overriding the files
- 404 on child page template
- Loop inside page template not working
- WordPress theme Modifications not showing up on live server
- add_action works outside condition but not inside it
- Should I create a child theme for a parent custom theme? [closed]
- I’m new in developing responsive WordPress Theme, so which framework to use or work from scratch? [closed]
- What is the point of using archive.php instead of index.php?
- How to automatically set a Template Page Name next to a page in menu screen such as WooCommerce pages, front page, or posts page in wordpress?