Skip to main content
Wordpress

Get direct children of current page

$services = get_pages(‘parent=’ . $posts[0]->ID . ‘&child_of=’ . $posts[0]->ID); ?>
        <section class=»services-grid»>
        <?php
            foreach ($services as $service):
                $title = get_the_title($service->ID);
                $image =  get_the_post_thumbnail($service->ID);
                $link = get_the_permalink($service->ID);
        ?>
            <div class=»service»>
                <h5><?php echo $title; ?></h5>
                <a href=»<?php echo $link; ?>»><?php echo $image; ?></a>
            </div><!–ends service–>
        <?php endforeach;

0 Reviews

There are no reviews yet.