WordPress. How to display the child pages?

Hello, just started to learn this CMS. Already a head around.
Rigged up like this here is the code, it will display only the posts, and it is necessary to page the output the child pages of the first level (without daughters). Tell me what to tweak. Read a lot, head around the solution of the problem is almost gone.
___
<?php if(have_posts()) : query_posts();while (have_posts()) : the_post();?>
<div class="col-md-4 col-sm-6 text-center">
 <div class="item" id="special-block">
 <div class="image">
 <img src="<?php echo get_template_directory_uri();?>/img/items-bg.png" alt="<?php single_post_title() ?>">
</div>
 <h3><a href="<? the_permalink();?>" class="h-link"><? the_title();?></a></h3>
</div>
</div>
<?php endwhile; endif; wp_reset_query(); ?>

Though if to specify for example

it displays what you need, but not to create, for each parent page template with its id.
July 2nd 19 at 17:15
1 answer
July 2nd 19 at 17:17
1. Never use query_posts(). This is the first thing must learn beginner WordPress developer. Forget you ever saw this feature and that it even exists. Use get_posts() or WP_Query or the pre_get_posts hook if you need to modify the main loop. It's all there in the documentation.
2. About pages do not quite understand the use case - and that is exactly where you need to bring. To output a single page template is used page.php. If you need the "archive" pages, then you are doing something wrong - they are not designed for this. Use custom post type.
3. Pages, posts and custom post types different type (post_type) that can be passed argument in the WP_Query, get_posts() or pre_get_post - 'post_type' => 'page' (if the arguments are passed as array) or &post_type=page (if the argument string).

Write in more detail where and what you want to achieve what purpose. Then it will be easier to explain.

UPD: working code in the comments
The structure of the site is that some pages have child pages (level 1). Some child page may have your daughter to have (level 2, respectively).
They will be assigned this template to a page view of a parent to her to withdraw all its child pages.
But... the template will be assigned and master pages parent and child level 1. I.e. it is necessary to withdraw only daughter 1 of nesting. Ie when viewing the parent, we see girls level 1, but not the second.
Something like this. - Mertie62 commented on July 2nd 19 at 17:20
: Display content of child pages need or menu/links to them? - Velva.Rogahn commented on July 2nd 19 at 17:23
And Yes, I read about the get_post but then there is such a jungle climbed that never came. Want to obtain ready-made solution (if super reviews) to the client to give (only because of this work worth it). And then it is tried to understand when the time to rush will not ( - Mertie62 commented on July 2nd 19 at 17:26
: The content. Namely, the title and the attached picture.
The Content Igor. Menu and links I already know how to derive )))
zenitrus.opexu.com/produkciya/drobilnoe-oborudovanie
Here is page one of these, but it shows the posts and not daughter - Mertie62 commented on July 2nd 19 at 17:29
: well here you have already an architectural wrong from the start. Products had to be done as a custom post type. If the link that you have static page, you need an arbitrary cycle to output the child pages. Logic - get ID of current page, get on it a child page.
$args = array(
 'post_parent' => the_ID(), // pages that are parented to the current page
 'post_type' => 'page', // type - page 
 'numberposts' => -1, // get all
 'post_status' => 'publish' // published 
);
$children = get_children( $args ); // get the array of objects

if ( $children ) {
 foreach ( $children as $child ) {
 var_dump( $child );
}
}
- Velva.Rogahn commented on July 2nd 19 at 17:32
:
Managed to solve it with your hint, thank you.
<?php
$args = array(
 'post_parent' =--> $post->ID, // pages that are parented to the current page
 'post_type' => 'page', // type - page 
 'numberposts' => -1, // get all
 'orderby' => 'ID',
 'post_status' => 'publish'
);
$myposts = get_posts( $args );
foreach( $myposts as $post ){ setup_postdata($post);
?>

 <div class="col-md-4 col-sm-6 text-center">
 <div class="item" id="special-block">
 <div class="image">
 <img src="<?php echo get_template_directory_uri();?>/img/items-bg.png" alt="<?php single_post_title() ?>">
</div>
 <h3><a href="<? the_permalink();?>" class="h-link"><? the_title();?></a></h3>
</div>
</div>

<?php
}
wp_reset_postdata(); // reset
?>
- Mertie62 commented on July 2nd 19 at 17:35
: answer mark - Velva.Rogahn commented on July 2nd 19 at 17:38

Find more questions by tags WordPressPHP