Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

McVeigh Services Shortcode

Outputs a list of all child pages of the services page

// Add Shortcode
function services_shortcode() {

	$args = array(
				    'post_type'      => 'page',
				    'posts_per_page' => -1,
				    'post_parent'    => 1865,
				    'order'          => 'ASC',
				    'orderby'        => 'menu_order'
				 );
	
	
	$parent = new WP_Query( $args );
	
	if ( $parent->have_posts() ) : ?>
	
		<section id="services-list" class="sec-pad">
			<div class="content-width">
				<h2>Our Services</h2>
				<div class="services-wrap">
			    <?php while ( $parent->have_posts() ) : $parent->the_post(); ?>
	
			        <div id="page-<?php the_ID(); ?>" class="service-page">
						<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
			            	<?php if( get_field('service_icon') ): ?>
			            		<img src="<?php the_field('service_icon'); ?>" />
			            	<?php endif; ?>
			            	<?php if( get_field('service_short_title') ): ?>
			            		<p class="service-title"><?php the_field('service_short_title'); ?></p>
			            	<?php else: ?>
			            		<p class="service-title"><?php the_title(); ?></p>
			            	<?php endif; ?>
			            	<!-- <div class="service-more">Learn More ▶</div>				      	 -->
			        	</a>
			        </div>
	
			    <?php endwhile; ?>
				</div>
			</div>
		</section>
	
	<?php endif;

}
add_shortcode( 'services-grid', 'services_shortcode' );