
I’m not sure if this is possible – but, I have flex content on a page called ‘recent_work’ which works fine.
I want to include that section near the footer so it pulls through whenever someone clicks a particular button.
This is my code so far, I follow this link here but even with 7017 (page number) – it doesn’t work…
<?php $post_id = 7017; ?>
<?php if( have_rows('recent_work') ): ?>
<div class="work">
<?php while( have_rows('recent_work') ): the_row(); ?>
<?php
$post_id = get_sub_field('work', false, false);
if( $post_id ):
?>
<div class="work__single">
<a href="<?php echo get_the_permalink($post_id); ?>" class="single_img" style="background-image:url('<?php the_field('preview_image', $post_id); ?>');">
</a>
<div class="single_cont">
<a href="<?php echo get_the_permalink($post_id); ?>"><h3><?php echo get_the_title($post_id); ?></h3></a>
<p><?php the_field('client_subheading', $post_id); ?></p>
<?php
$featured_posts = get_field('services', $post_id);
if( $featured_posts ):
?>
<ul class="services_points">
<?php foreach( $featured_posts as $post ):
// Setup this post for WP functions (variable must be named $post).
setup_postdata($post); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
<?php
// Reset the global post object so that the rest of the page works correctly.
wp_reset_postdata(); ?>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php endwhile; ?>
</div>
<?php endif; ?>
<?php wp_reset_query(); ?>