0

I know this question has been answered before but for the life of me, I can't find it anymore.

I created a few custom post types and custom fields using ACF, now I know how to display the info in my child theme, what I'm struggling with is creating a custom genesis archive loop, I don't want to output anything on a single post, everything is just displayed on the archive page (I can't think of any other or better way to do this)

What I want to know is how do I format the following code correctly to work with a custom loop?

<?php
/**
* Template for trucks CPT archive page.
*/

add_filter('genesis_pre_get_option_site_layout','__genesis_return_full_width_content' );
remove_action('genesis_before_post_content','genesis_post_info');
remove_action('genesis_after_post_content','genesis_post_meta');

// Custom loop

<h2><?php the_title(); ?></h2>

<?php the_field('registration_number'); ?>

<?php 

$posts = get_field('truck_driver');

if( $posts ): ?>
    <ul>
        <li>
            <?php the_field('full_name'); ?>
        </li>
    </ul>
<?php endif; ?>

<?php 

$posts = get_field('route');

if( $posts ): ?>
    <ul>
        <li>
            From:<?php the_field('route_from'); ?>
        </li>
        <li>
            To:<?php the_field('route_to'); ?>
        </li>
    </ul>
<?php endif; ?>

// Custom loop ends

genesis();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.