Support

Account

Home Forums Backend Issues (wp-admin) Tips for making custom form fields look good in admin? Reply To: Tips for making custom form fields look good in admin?

  • Hi @preserved

    You can add HTML to any WP page by hooking into the ‘admin_footer’ action, checking that the url is correct for the page you want, and then injecting extra HTML into the page. Here’s a idea of the code:

    add_action('admin_footer', 'my_admin_footer');
    
    function my_admin_footer() {
    	
    	// vars
    	$page = 'acf-options-cwl-settings';
    	
    	
    	// bail early if not correct page
    	if( empty($_GET['page']) || $_GET['page'] !== $page ) {
    		
    		return;
    		
    	}
    	
    	
    ?>
    <div id="my-html">
    	<p>test</p>
    </div>
    <script type="text/javascript">
    (function($) {
    	
    	// move #my-html
    	$('#post-body-content').append( $('#my-html') );
    	
    })(jQuery);	
    </script>
    <?php
    	
    }