I'm using advanced custom fields and I have the following code:
<?php $args = array( 'numberposts' => 3 ); $lastposts = get_posts( $args ); foreach($lastposts as $post) : setup_postdata($post); ?>
Where the number of posts = 3, I was wondering if I could turn this into a custom field in the editor so that my client can easily change how many posts per page should display. Now using my 'simple this is how it should work' PHP brain, I thought I could use the following:
<?php $numposts = <?php the_field('number_of_posts', $number_of_posts); ?>; ?>
But it doesn't quite work.
Any tips? Thanks.