Home › Forums › Front-end Issues › Custom Field Group and how to show it?
Hi Guys im trying to add a custom field group. Basically I have a submit form on http://www.nybygget.dk/tilfoj-byggeri.
This form has specific field groups. The one you see is a “logout” field group.
I would like to have additional fields that is needed on the form. I have tried to register them using this guide:
https://www.advancedcustomfields.com/resources/register-fields-via-php/
And exporting my field group that I want to show.
I took the export code and added to the top of the functions.php, but now im stuck with the documentation?
How do i make it show on the tilfoj-byggeri page?, do I have to call the function inside the template for the page, the template for the page is : Template-property-submit.php
Do I call it with
<?php acf_form(); ?>
I hope someone can help me 🙂 Thank you everyone.
This is the code I added to functions.php no result not showing anywhere, what do I need to do or what dont i understand?
function my_acf_add_local_field_groups() {
acf_add_local_field_group(array (
‘key’ => ‘group_5b013ab0c5a1c’,
‘title’ => ‘Additional Details (prefix field name with “additional_”)’,
‘fields’ => array (
array (
‘key’ => ‘field_5b013aba8f986’,
‘label’ => ‘Bygherre’,
‘name’ => ‘additional_bygherre’,
‘type’ => ‘text’,
‘instructions’ => ”,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array (
‘width’ => ”,
‘class’ => ”,
‘id’ => ”,
),
‘default_value’ => ”,
‘placeholder’ => ”,
‘prepend’ => ”,
‘append’ => ”,
‘maxlength’ => ”,
),
array (
‘key’ => ‘field_5b013b2b8f991’,
‘label’ => ‘Facebook’,
‘name’ => ‘additional_facebook’,
‘type’ => ‘url’,
‘instructions’ => ‘Link til Facebookside for byggeriet.’,
‘required’ => 0,
‘conditional_logic’ => 0,
‘wrapper’ => array (
‘width’ => ”,
‘class’ => ”,
‘id’ => ”,
),
‘default_value’ => ”,
‘placeholder’ => ”,
),
),
‘location’ => array (
array (
array (
‘param’ => ‘post_type’,
‘operator’ => ‘==’,
‘value’ => ‘property’,
),
array (
‘param’ => ‘current_user’,
‘operator’ => ‘==’,
‘value’ => ‘viewing_back’,
),
),
),
‘menu_order’ => 0,
‘position’ => ‘normal’,
‘style’ => ‘default’,
‘label_placement’ => ‘top’,
‘instruction_placement’ => ‘label’,
‘hide_on_screen’ => ”,
‘active’ => 1,
‘description’ => ”,
));
}
add_action(‘acf/init’, ‘my_acf_add_local_field_groups’);
You must be logged in to reply to this topic.
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!
ACF wouldn’t be so widely used in WordPress if it didn’t have some pretty amazing capabilities. In this article, we look at a few of the features we’ll discuss during “7 things you didn’t know you could do with ACF” at #WPEDecode later this month. https://t.co/5lnsTxp81j pic.twitter.com/Yf0ThPG1QG
— Advanced Custom Fields (@wp_acf) March 16, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.