Last active
November 3, 2018 14:47
-
-
Save salaros/1fa92b3b65251c4f6f5787f0eca165ad to your computer and use it in GitHub Desktop.
WordPress - ACF custom forms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'acf.php'; | |
add_action('admin_head', function () { | |
do_action('acf/input/admin_head'); | |
acf_form_head(); | |
wp_enqueue_media(); | |
}); | |
add_action('admin_enqueue_scripts', function () { | |
wp_enqueue_script('acf-input'); | |
}); | |
\Timber::render( 'backend-form.twig', null ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="wrap"> | |
<form method="post" action=""> | |
{{ fn( 'acf_form', { | |
'field_groups': [ 'acf_tracking_mapping' ], | |
'form': false, | |
'post_id': 'mypageid' | |
}) }} | |
{{ fn( 'submit_button' ) }} | |
</form> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
register_field_group(array ( | |
'id' => 'acf_tracking_mapping', | |
'title' => 'Tracking array mapping', | |
'fields' => array ( | |
array ( | |
// Put some fields here | |
), | |
), | |
'location' => array(), // Won't appear anyway | |
'options' => array ( | |
'position' => 'normal', | |
'layout' => 'no_box', | |
'hide_on_screen' => array ( | |
), | |
), | |
'menu_order' => 0, | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment