Wordpress homepage with latest posts and Advanced Custom fields - How?

Posted by Allan Crabtree on Stack Overflow See other posts from Stack Overflow or by Allan Crabtree
Published on 2013-10-08T21:46:43Z Indexed on 2013/11/08 21:54 UTC
Read the original article Hit count: 214

I'd like my homepage to display my latest posts which are portfolio projects of mine. Beneath these project thumbnails I've got my static content which I'm using the Repeater add-on from Advanced Custom Fields to grab. I cant get it all to work on the same page... either get the blog to work or the ACF stuff to work. Never both because one needs to be a designated static page and one needs to be a posts page. I don't understand how to tie it together and make it appear as one page.

I've experimented with the settings in the reading panel.. I've tried using front-page.php I've read up on the WP hierarchy etc I've tried using templates... I've tried wp_reset_postdata(); which I read about elsewhere on Stack Overflow.

What settings must I use in the reading panel. Do I need to use a template file?

Here's the code I'm working with, I've split the code between templates and different files already, but just for ease of reading its all together here (maybe that's the right way to do it anyway, I wouldn't know..)

<!-- The posts/portfolio items -->

<?php get_header(); ?>   
<div>
<?php if(have_posts()) : ?>
    <ul>
    <?php while ( have_posts() ) : the_post(); ?>
        <li>
            <!-- Permalink,title and post thumbnail here (omitted) -->
        </li>
    <?php endwhile; ?>
    </ul>
   <?php else: ?>
<h2>No Posts found</h2>
<?php endif; ?>
</div>


<!-- Now for the ACF Stuff -->

<?php if(get_field('care_list')): ?>
    <?php while(has_sub_field('care_list')): ?>

        <div class="grid_2 what-i-care-about gap">
           <div class="important-img-container">
           <?php the_sub_field('care_list_image'); ?>
        </div>
           <h3><?php the_sub_field('care_list_title'); ?></h3>
        </div>
    <?php endwhile; ?>
<?php endif; ?>

<?php get_footer(); ?>

Please help a frustrated learner! Thanks in advance.

© Stack Overflow or respective owner

Related posts about Wordpress

Related posts about advanced-custom-fields