Last active
April 26, 2020 15:41
-
-
Save krasenslavov/81dc4aa5efd6ff9621154551923247ea to your computer and use it in GitHub Desktop.
CPT UI + Advanced Custom Fields + Front-end data collection form. Visit blog post https://bit.ly/2KwpDWK
This file contains 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 | |
/** | |
* Template Name: Add Restaurant | |
* Template Post Type: page | |
* | |
* @package WordPress | |
* @subpackage Twenty_Twenty | |
* @since Twenty Twenty 1.0 | |
*/ | |
acf_form_head(); | |
get_header(); | |
?> | |
<main id="site-content" role="main"> | |
<div class="page type-page status-publish hentry"> | |
<div class="post-inner thin"> | |
<div class="entry-content"> | |
<?php | |
if (have_posts()) { | |
while (have_posts()) { | |
the_post(); | |
acf_form(array( | |
'id' => 4, | |
'post_id' => 'new_post', | |
'new_post' => array( | |
'post_type' => 'restaurants', | |
'post_status' => 'draft', | |
), | |
'uploader' => 'basic', | |
'submit_value' => 'Submit Your Restaurant →', | |
)); | |
} | |
} | |
?> | |
</div> | |
</div> | |
</div> | |
</main> | |
<?php | |
acf_enqueue_uploader(); | |
get_footer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment