In my project I need to display custom post fields form on front end , so I have installed ACF and created custom filed , now my issue is how to render these fields along with the HTML ???? I used get_fields() function , still it won't display any HTML code .
-
how did you use get_fields()? show us.. – ihsan Feb 20 '14 at 05:13
5 Answers
If you want to show the fields inside the post, you have to place the code inside the loop of "single.php", supposing you are using the standard post type.
This code retrive the field only, it won't show anything, it's used to store the value in a variable:
get_field('field-name');
To make the fields show in the template you have to use the following:
the_field('field-name');
You can also insert the code in the archive template or query post your are using to show posts.
This also would work:
echo get_field('field-name')
or
$myfield = get_field('field-name');
echo $myfield;

- 59
- 1
- 7
You could use ACF Frontend display plugin: https://wordpress.org/plugins/acf-frontend-display
Check "display on front" within post or page editing.
If you want add some actions try to use Forms actions plugin: https://wordpress.org/plugins/forms-actions/

- 11
- 2
Add that code no your template :
<?php
/**
* Template Name: Resume Build
*
* @package Betheme
* @author Muffin Group
*/
?>
<?php
/**
* The main template file.
*
* @package Betheme
* @author Muffin group
* @link http://muffingroup.com
*/
acf_form_head();
get_header();
?>
<!-- #Content -->
<div id="Content">
<div class="content_wrapper clearfix">
<!-- .sections_group -->
<div class="sections_group">
<div id="content">
<?php
acf_form(array(
'post_id' => 'new_post',
'post_title' => true,
'post_content' => false,
'new_post' => array(
'post_type' => 'resume',
'post_status' => 'publish'
)
));
?>
</div>
</div>
<!-- .four-columns - sidebar -->
<?php get_sidebar( 'blog' ); ?>
</div>
</div>
<?php get_footer();
// Omit Closing PHP Tags

- 1,048
- 9
- 19
Have a look at this Documents...
You can add fields or full form with following function,
$options = array(
'post_id' => $post->ID, // post id to get field groups from and save data to
'field_groups' => array(), // this will find the field groups for this post (post ID's of the acf post objects)
'form' => true, // set this to false to prevent the <form> tag from being created
'form_attributes' => array( // attributes will be added to the form element
'id' => 'post',
'class' => '',
'action' => '',
'method' => 'post',
),
'return' => add_query_arg( 'updated', 'true', get_permalink() ), // return url
'html_before_fields' => '', // html inside form before fields
'html_after_fields' => '', // html inside form after fields
'submit_value' => 'Update', // value for submit field
'updated_message' => 'Post updated.', // default updated message. Can be false to show no message
);
acf_form( $options );
Hope this will help you...

- 108
- 1
- 6

- 3,599
- 2
- 22
- 41
-
Hi , Thanks for helping me out , but this is my requirement . I created one custom field group.. and I am allowing users to create posts from FF ,so when when users create new post I want this fields to be visible to users... – user1452840 Feb 20 '14 at 05:52