Support

Account

Home Forums Front-end Issues How do I render a checkbox field on the frontend

Helping

How do I render a checkbox field on the frontend

  • I can render the radio input easily with:

    
    get_field('mdf_campaign_prospects');
    

    How can I add the form radio input to the front end? I’m happy to do it manually, but I need to get it’s list of possible options back so I need to do that.

    Is there something like:

    
    render_field('mdf_campaign_prospects');
    
  • HI @designer023

    Thanks for the post.

    To render fields in the frontend you will need to make use of the acf_form() and the acf_form_head() functions within your template.

    The code would like so:

    <?php acf_form_head(); ?>
    <?php get_header(); ?>
    
    	<div id="primary" class="content-area">
    		<div id="content" class="site-content" role="main">
    
    			<?php /* The loop */ ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    
    				<?php acf_form(array(
    					'post_id'	=> 123,
    					'post_title'	=> false,
                                            'fields'        => array(field_fd152627e),
    					'submit_value'	=> 'Update the post!'
    				)); ?>
    
    			<?php endwhile; ?>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘How do I render a checkbox field on the frontend’ is closed to new replies.