create a new field group in functions.php then add it in your template code like this
// in functions.php //
add_action('acf/register_fields', 'register_field_group');
if(function_exists("register_field_group"))
{
register_field_group(array (
'id' => 'acf_form-post-title',
'title' => 'Form Post Title',
'fields' => array (
array (
'key' => 'field_25',
'label' => 'Title',
'name' => 'form_post_title',
'type' => 'text',
'default_value' => '',
'formatting' => 'html',
),
),
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'course',
'order_no' => 0,
'group_no' => 0,
),
),
),
'options' => array (
'position' => 'normal',
'layout' => 'no_box',
'hide_on_screen' => array (
),
),
'menu_order' => -2,
));
}
// in you template page //
acf_form(array(
'post_id' => 'new_post',
'new_post' => array(
'post_type' => 'custom',
'post_status' => 'draft',
'
),
'field_groups' => array(49, 'acf_form-post-title'),
'submit_value' => 'Submit',
));
can you show me your template page code?
error fixed…
woo tabs class name and our ACF field class names are same
i have solved it by follow this steps
Go to –> wp-content\themes\canvas\includes\widgets\widget-woo-tabs.php
And then find this lines –>
// Tab contents = .inside
var tag_cloud_class = '#tagcloud';
//Fix for tag clouds - unexpected height before .hide()
var tag_cloud_height = jQuery( '#tagcloud').height();
jQuery( '.inside ul li:last-child').css( 'border-bottom','0px' ); // remove last border-bottom from list in tab content
jQuery( '.wooTabs').each(function(){
jQuery(this).children( 'li').children( 'a:first').addClass( 'selected' ); // Add .selected class to first tab on load
});
jQuery( '.inside > *').hide();
jQuery( '.inside > *:first-child').show();
Then replace the code like this –>
// Tab contents = .inside
var woo_class = false;
var tag_cloud_class = '#tagcloud';
//Fix for tag clouds - unexpected height before .hide()
var tag_cloud_height = jQuery( '#tagcloud').height();
jQuery( '.inside ul li:last-child').css( 'border-bottom','0px' ); // remove last border-bottom from list in tab content
jQuery( '.wooTabs').each(function(){
jQuery(this).children( 'li').children( 'a:first').addClass( 'selected' ); // Add .selected class to first tab on load
woo_class = true;
});
if(woo_class = true) {
jQuery( '.inside > *').hide();
jQuery( '.inside > *:first-child').show();
}
Me too having the same problem.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.