Home › Forums › Backend Issues (wp-admin) › Add Html to acf meta-box › Reply To: Add Html to acf meta-box
Hi @buckdanny
The priority should be working, but I’m not sure why it isn’t. As a workaround, you can use JQuery to move the extra HTML like this:
function my_acf_admin_footer() {
?>
<script type="text/javascript">
(function($){
$( document ).ready(function() {
$(".admin-input-extra-top").each(function(){
$(this).prependTo($(this).parents(".acf-field"));
});
$(".admin-input-extra-bottom").each(function(){
$(this).appendTo($(this).parents(".acf-field"));
});
});
})(jQuery);
</script>
<?php
}
add_action('acf/input/admin_footer', 'my_acf_admin_footer');
function action_function_name( $field ) {
if ($field['key'] == "field_56498520140a4"){
echo '<div class="admin-input-extra-top">This is the top</div>';
echo '<div class="admin-input-extra-bottom">This is the bottom</div>';
}
}
add_action( 'acf/render_field', 'action_function_name', 10, 1 );
This will move everything in “admin-input-extra-top” class to the top of the label and everything in “admin-input-extra-bottom” class to the bottom of the input.
I hope this helps.
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.