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 🙂
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.