Support

Account

Home Forums Front-end Issues Not working scripts ACF logic Reply To: Not working scripts ACF logic

  • 
    <?php
    /*
    Template Name: ACF Form
    */
    acf_form_head();
    get_header();
    acf_enqueue_uploader();
    
    ?>
    
    <div class="acf-grid">
        <div class="grid">
            <div class="col-3" id='category'></div>
            <div class="col-9 grid">
                <div class="col-12 grid">
                    <div class="col-6" id='cat-box'></div>
                    <div class="col-6"></div>
                </div>
                <div class="col-12 grid">
                    <div class="col-6" id='adres'></div>
                    <div class="col-6" id='contacty'></div>
                </div>
            </div>
        </div>
        <div class="grid">
            <div class="col-9" id='descriptions'></div>
            <div class="col-3" id='add-file'></div>
        </div>
    </div>
    <?php
    $args = array(
        'post_id' => 'new_post',
        'new_post' => array(
            'post_type' => 'markers',
            'post_status' => 'draft',
        ),
        'post_title' => false,
        'submit_value' => 'Создать',
        'updated_message' => 'Ваша запись поставлена в очередь на модерацию'
    );
    acf_form( $args );
    ?>
    <script type="text/javascript">
        //$(document).ready(function() {	
        acf.add_action('ready', function( $el ){    
            $('.acf-grid').appendTo('.acf-form-fields');
            $('.category').appendTo('#category');
            $('.cat-box').appendTo('#cat-box');
            $('.adres').appendTo('#adres');
            $('.contacty').appendTo('#contacty');
            $('.descriptions').appendTo('#descriptions');
            $('.add-file').appendTo('#add-file');
        });
        //});	
    </script>
    <?php get_footer(); ?>