Fix for Advanced Custom Fields high priority
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
// Move elements around screen. | |
acf.addAction('prepare', function(){ | |
// Use setTimeout to make sure field is loaded | |
setTimeout(function(){ | |
// Move #acf_after_title-sortables after | |
// Post Title box and add classes and css for styling | |
// and presentation | |
$('.editor-post-title').after( | |
$('#acf_after_title-sortables') | |
.addClass('wp-block') | |
.css('margin', '20px auto 40px') | |
); | |
} | |
, 1000); | |
// On save create copy of #acf_after_title-sortables and inset in #poststuff | |
$(document).on('click','.editor-post-publish-button', function(){ | |
// Check if container in postbox is created | |
if($('#poststuff .postbox-container #acf_after_title-sortables-copy').length){ | |
$('#poststuff .postbox-container #acf_after_title-sortables-copy').html( | |
// Update form with data | |
$('#acf_after_title-sortables').html() | |
); | |
}else{ | |
// Create clone of #acf_after_title-sortables and insert in #poststuff | |
$('#acf_after_title-sortables') | |
.clone() | |
.attr('id','acf_after_title-sortables-copy') | |
.hide() | |
.appendTo( $('#poststuff .postbox-container') ); | |
} | |
}); | |
}, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment