Support

Account

Home Forums Feature Requests "Move content editor to here" Field Type Reply To: "Move content editor to here" Field Type

  • Hi @charles9

    If you want to move it on template change, I believe you can try this code:

    add_action('acf/input/admin_head', 'my_acf_admin_head');
    
    function my_acf_admin_head() {
        
        ?>
        <script type="text/javascript">
        (function($) {
            
            $(document).ready(function(){
                
                // Do it when the page load
                if( $("select#page_template").val() == "page-template-test.php" ){
                    
                    // move to the message field
                    $('.acf-field-56d98ab4fdfde .acf-input').append( $('#postdivrich') );
                    
                } else {
                    
                    // move back to the default place
                    $('#post-body-content').append( $('#postdivrich') );
                    
                }
                
                
                // Do it when the template is changed
                $(document).on("change", "select#page_template", function(){
                    if( $("select#page_template").val() == "page-template-test.php" ){
                        $('.acf-field-56d98ab4fdfde .acf-input').append( $('#postdivrich') );
                    } else {
                        $('#post-body-content').append( $('#postdivrich') );
                    }
                });
                
                
            });
            
        })(jQuery);    
        </script>
        <style type="text/css">
            .acf-field #wp-content-editor-tools {
                background: transparent;
                padding-top: 0;
            }
        </style>
        <?php    
        
    }

    If that is not what you want, could you please share some screenshots of the issue and explain it again?

    Thanks 🙂