I'm trying to use the advanced custom fields plugin and associate it with a partial (probably not the right word) that I wrote that would display the fields from the custom post type.
How do I associate a php file with the custom post type?
The objective is to be able to embed the partial in a post.
Here is my partial: cta-partial.php
<?php
/*
Template Name: CTA-Partial
*/
?>
<!-- cta markup -->
<!-- if there is an article then load -->
<?php
$args = array(
'post_type' => 'cta_post_type'
);
$query = new WP_Query( $args ); ?>
<?php if( $query->have_posts() ) : while( $query->have_posts() ) :
$query->the_post();?>
</div>
</div>
<!-- end the markup so as to allow full-width -->
<div class="article" style="background-image: url('<?php the_field('cta_background'); ?>')">
<div class="custom-background">
<div class="columns small-12 medium-6 image-container">
<div class="hide-for-medium">
<img src="<?php the_field('cta_background'); ?>">
</div>
</div>
<div class="columns small-12 medium-6 mobile-style">
<h1> <?php the_field('cta_title');?></h1>
<p><?php the_field('cta_text'); ?></p>
<a href="<?php the_field('button_link');?>"><button><?php the_field('button_label')?></button></a>
</div>
</div>
</div>
<div class="row">
<div class="columns small-12 medium-12 content-wrapper">
<!-- continue content loop -->
<?php endwhile; endif; wp_reset_postdata(); ?>
This is the file i'd like to render the php associated with my custom fields post type.
Here is the documentation for ACF: https://www.advancedcustomfields.com/resources/ I've been scouring the docs and i'm not sure if it's possible. Thank you for the help so far, still researching.