Skip to main content
edited body
Source Link

please add your Custom post type slugname here 'post_type' => 'Services', // required

<?php
    $args=array(
                'post_parent' => 0, // required
                'post_type' => 'Services', // required
                'orderby' => 'menu_order', // to display according to hierarchy
                'order' => 'ASC', // to display according to hierarchy
                'posts_per_page' => -1, // to display all because default is 10
    );
    $query = null;
    $query = new WP_Query( $args ); 

    if ( $query->have_posts() ) {
        while($query->have_posts()) {
            $query->the_post();
            $post_id=get_the_ID();
            $post=get_post($post_id,'ARRAY_A');                
            echo $post['ID'].': '.$post['post_title'].'<br>';
        }            
    }
 wp_reset_query($query);
?>

please add your Custom post type slug here 'post_type' => 'Services', // required

<?php
    $args=array(
                'post_parent' => 0, // required
                'post_type' => 'Services', // required
                'orderby' => 'menu_order', // to display according to hierarchy
                'order' => 'ASC', // to display according to hierarchy
                'posts_per_page' => -1, // to display all because default is 10
    );
    $query = null;
    $query = new WP_Query( $args ); 

    if ( $query->have_posts() ) {
        while($query->have_posts()) {
            $query->the_post();
            $post_id=get_the_ID();
            $post=get_post($post_id,'ARRAY_A');                
            echo $post['ID'].': '.$post['post_title'].'<br>';
        }            
    }
 wp_reset_query($query);
?>

please add your Custom post type name here 'post_type' => 'Services', // required

<?php
    $args=array(
                'post_parent' => 0, // required
                'post_type' => 'Services', // required
                'orderby' => 'menu_order', // to display according to hierarchy
                'order' => 'ASC', // to display according to hierarchy
                'posts_per_page' => -1, // to display all because default is 10
    );
    $query = null;
    $query = new WP_Query( $args ); 

    if ( $query->have_posts() ) {
        while($query->have_posts()) {
            $query->the_post();
            $post_id=get_the_ID();
            $post=get_post($post_id,'ARRAY_A');                
            echo $post['ID'].': '.$post['post_title'].'<br>';
        }            
    }
 wp_reset_query($query);
?>
deleted 68 characters in body
Source Link

please add your Custom post type slug here 'post_type' => 'Services', // required

<?php
    $args=array(
                'post_parent' => 0, // required
                'post_type' => 'Services', // required
                'orderby' => 'menu_order', // to display according to hierarchy
                'order' => 'ASC', // to display according to hierarchy
                'posts_per_page' => -1, // to display all because default is 10
    );
 
    $query = new \WP_Query( $args ); 
null;
    /*  Uncomment to see the resulting SQL to debug
 $query = new echoWP_Query( $query->request;$args die();
    //*/

    if ( $query->have_posts() ) {
        while($query->have_posts()) {
            $query->the_post();
            $post_id=get_the_ID();
            $post=get_post($post_id,'ARRAY_A');                
            echo $post['ID'].': '.$post['post_title'].'<br>';
        }            
    }
 wp_reset_query($query);
?>

please add your Custom post type slug here 'post_type' => 'Services', // required

<?php
    $args=array(
                'post_parent' => 0, // required
                'post_type' => 'Services', // required
                'orderby' => 'menu_order', // to display according to hierarchy
                'order' => 'ASC', // to display according to hierarchy
                'posts_per_page' => -1, // to display all because default is 10
    );
 
    $query = new \WP_Query( $args ); 

    /*  Uncomment to see the resulting SQL to debug
    echo $query->request; die();
    //*/

    if ( $query->have_posts() ) {
        while($query->have_posts()) {
            $query->the_post();
            $post_id=get_the_ID();
            $post=get_post($post_id,'ARRAY_A');                
            echo $post['ID'].': '.$post['post_title'].'<br>';
        }            
    }
?>

please add your Custom post type slug here 'post_type' => 'Services', // required

<?php
    $args=array(
                'post_parent' => 0, // required
                'post_type' => 'Services', // required
                'orderby' => 'menu_order', // to display according to hierarchy
                'order' => 'ASC', // to display according to hierarchy
                'posts_per_page' => -1, // to display all because default is 10
    );
    $query = null;
    $query = new WP_Query( $args ); 

    if ( $query->have_posts() ) {
        while($query->have_posts()) {
            $query->the_post();
            $post_id=get_the_ID();
            $post=get_post($post_id,'ARRAY_A');                
            echo $post['ID'].': '.$post['post_title'].'<br>';
        }            
    }
 wp_reset_query($query);
?>
Source Link

please add your Custom post type slug here 'post_type' => 'Services', // required

<?php
    $args=array(
                'post_parent' => 0, // required
                'post_type' => 'Services', // required
                'orderby' => 'menu_order', // to display according to hierarchy
                'order' => 'ASC', // to display according to hierarchy
                'posts_per_page' => -1, // to display all because default is 10
    );

    $query = new \WP_Query( $args ); 

    /*  Uncomment to see the resulting SQL to debug
    echo $query->request; die();
    //*/

    if ( $query->have_posts() ) {
        while($query->have_posts()) {
            $query->the_post();
            $post_id=get_the_ID();
            $post=get_post($post_id,'ARRAY_A');                
            echo $post['ID'].': '.$post['post_title'].'<br>';
        }            
    }
?>