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]
- Converting a theme to a child theme in a network
- Trouble in creating a custom template on twentyeleven theme
- Is there a template tag I can use to link to the archive page corresponding to the month that a post was published on?
- How to modify theme content in Thematic?
- Understrap-child conditional js script
- Custom search template is showing 404 when adding query string
- ACF get_sub_field ALT TAG in the repeater doesn’t show
- How to Modify WP_Includes/blocks/latest_posts.php
- A Reviews Page is Showing root Index.php instead of Template-Page
- No templates for condition page.php Elementor
- 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]
- How to implement pagination in category.php template
- Copying a modified theme from one wordpress site to another wordpress site [closed]
- How can I access variables from theme in child theme? [closed]
- How to display home page last modified date in anywhere of wordpress theme?
- Show Yoast SEO meta tags in Custom WordPress Templates (Theme)
- What is an alternative to not using child theme to customize a WordPress theme?
- Block validation failed for `core/pullquote` after adding theme support for editor-color-palette
- Where i must put hooks in overridable functions?
- Is_single not working properly in genesis
- How can I make custom page templates work on child theme?
- (Parent) theme Is Not Showing In Theme Selection Panel and Therefore Breaks Child Theme
- Child theme menu not appearing in Twenty Seventeen
- Edit Product Archive design for Woo theme
- How can I fix my theme header for my CSS stylesheet?
- How to test another theme in a live WordPress website instead of live preview?
- Duplicate child theme incl. design changes
- Move the social media icons to the left of a WordPress nav menu for Soledad child Theme
- Using wp_add_inline_style Inside a Template File
- which template should I use for single category post?
- How to connect two child themes on different sub domains to the same base theme
- Should I use template files or just use conditional tags in index.php?
- Debugging slow WordPress Theme Customizer (Any option similar to Query Monitor)?
- Different templates for each category level
- Group several custom global page templates in sub-folder
- Editing Them with Child Theme Basics [closed]
- Problem with Displaying Custom Theme Page’s Content
- How to customize the colors within a stylesheet using a WordPress setting
- Displaying Child Page’s Information
- Change header image on a particular page
- Update modified Shopify third-party theme [closed]
- how can I re-utilize and class on a child theme
- Providing updates to your WordPress theme
- Different stylesheet for different pages not working fully
- Display content on Single page
- Hook in parent theme Menu function
- WordPress Child Theme Template auth_redirect wrapper
- How do child themes work?
- Using require_once for parent-directory not working but is working in sub-directories
- Protecting work on client’s web host
- Menu order of parent menu from perspective of child menu
- Can you create a custom page with content in the center already defined?
- custom template – override plugin template in child theme – issue with scripts
- How to migrate the menu from the site on my own theme in WordPress?
- How can I fix the even/odd child classes comments so that the comments are unaffected by the top-level even/odd?
- 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]
- adding navigation to genesis themes
- Extending arrays in parent theme without completely overriding the files
- Paginated WP_Query doesn’t return 404’s, even when posts don’t exist
- Standard Way To Do Custom Work Within A Page?
- 404 on child page template
- What is the advantage of using home.php over index.php for the front page
- Loop inside page template not working
- WordPress theme Modifications not showing up on live server
- What to do when child theme is out of date with parent theme
- Extracting Distance from FacetWP Proximity Function to Display in WordPress Template
- add_action works outside condition but not inside it
- Global Navigation menu in diiferrent wordpress setups
- Best practice to create required pages
- Image Size wrong during upload
- How customizable is a self-hosted WordPress blog compared to a Blogger blog?
- Is there any way to show child theme in theme detectors?
- Should I create a child theme for a parent custom theme? [closed]