Hi,
I am having some trouble getting a custom post_type I created with custom taxonomies to display on the front end. The custom post_type is called “partnerships” and there are 3 taxonomies “Donors”, “Community Partners” and “Sponsors”. In the backend I have a repeater field called “partner_info” that has 3 fields for a partner_logo, partner_url and partner_name. I would like to have each of these fields displayed by the taxonomy (which I will then place into different tabs on the same page). I have no idea if I am even coding this correctly since I can’t get it to display on the front end. Does anyone have any insight?
Custom Post_Type Code
add_action( 'init', 'partnerships_register' );
function partnerships_register() {
register_post_type( 'partnerships',
array(
'labels' => array(
'name' => __( 'Partnerships' ),
'singular_name' => __( 'Partnerships' )
),
'exclude_from_search' => true,
'public' => true,
'menu_icon' => 'dashicons-groups',
'supports' => array( 'title', 'thumbnail'),
'has_archive' => false,
'capability_type' => 'post',
'show_ui' => true,
'query_var' => true,
'rewrite' => false,
'hierarchical' => false,
)
);
}
function add_partnerships_taxonomy() {
register_taxonomy(
'partnerships_type', 'partnerships',
array(
'hierarchical' => true,
'label' => 'Partnerships Type',
'query_var' => true,
'show_admin_column' => true,
'rewrite' => false,
'with_front' => false
)
);
}
add_action( 'init', 'add_partnerships_taxonomy' );
ACF Front End Code
<?php
$args = array( 'post_type' => 'partnerships', 'posts_per_page' => -1 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
$terms = get_the_terms( $post->ID, 'partnership_type' );
if ( $terms && ! is_wp_error( $terms ) ) :
foreach ( $terms as $term );
endif; ?>
<div class="three columns"><div class="flip-item"><div class="front"><img src="<?php echo $term->partner_logo; ?>" alt=""></img></div><div class="back"><p><?php echo $term->partner_name; ?></p><p><?php echo $term->partner_url; ?></p></div></div></div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>