I am using ACF plugin for the first time and I was able to successfully display a Sponsor to my front page. But now I am trying to add a custom input field as,
Other Contribution: <text box that accepts numbers>
The user should be able to enter some amount in the above text box. And on the next page I retrieve the value entered by the user and use it.
I created a new “Field Group” as “Other Contribution” and added a field to it as “Additional Contribution” with field type as ‘Number’ and Location Rule as “Post Type is equal to post”. Then I added the following code to functions.php but the home page doesn’t load completely. It displays the heading “Registration” and nothing else below it.
function ee_event_contribution()
{
?>
<div id=”primary”>
<div id=”content” role=”main”>
<?php /* The loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php acf_form(array(
‘post_id’ => ‘new’,
‘field_groups’ => array(122),
‘new_post’ => array(
‘post_type’ => ‘event’,
‘post_status’ => ‘publish’),
‘submit_value’ => ‘Update the post!’
)); ?>
<?php endwhile; ?>
</div><!– #content –>
</div><!– #primary –>
<?php
}
add_action( ‘AHEE_event_details_after_the_content’, ‘ee_event_contribution’ );
I also added <?php acf_form_head(); ?> to the beginning to the file functions.php
If someone has done something similar, I would appreciate their help!