Support

Account

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.