Wordpress

Get direct children of current page

By febrero 6, 2017 mayo 31st, 2020 No Comments

$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;

Leave a Reply