Check if is on child-page of a particular page

You can do that with $post->post_parent. You will have to check if child page’s parent is Services page. So this is how you will check it. I assumed 123 in following code is page ID of your services page. Replace it with actual ID. if ( 123 == $post->post_parent ) { ?> <div class=”col-md-2 col-sm-4″> … Read more

Get parent page url to show up when it is in child pages

You can use something like this to get the parent page URL (and show its page title): <?php if ( $post->post_parent ) { ?> <a href=”https://wordpress.stackexchange.com/questions/192895/<?php echo get_permalink( $post->post_parent ); ?>” > <?php echo get_the_title( $post->post_parent ); ?> </a> <?php } ?> If you are running this code outside of the loop (thanks @BorisKuzmanov), then … Read more

wp query to get child pages of current page

You have to change child_of to post_parent and also add post_type => ‘page’: WordPress codex Wp_query Post & Page Parameters <?php $args = array( ‘post_type’ => ‘page’, ‘posts_per_page’ => -1, ‘post_parent’ => $post->ID, ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order’ ); $parent = new WP_Query( $args ); if ( $parent->have_posts() ) : ?> <?php while ( … Read more