Support

Account

Home Forums Add-ons Options Page Add Instructions to Options Page

Solved

Add Instructions to Options Page

  • I have an “options page” set up, and would like to add a set of instructions to that page (not the WP “contextual help”). Is this possible? I’ve done this with a custom post type edit post page, but am having trouble getting this to work with an ACF options page.

    Here’s the code I used for the CPT edit post page:

    function options_instructions_example() {
    	global $my_admin_page;
    	$screen = get_current_screen();
    
    	if ( is_admin() && ($screen->id == 'custom_post_type_name') ) {
    		
    		function add_content_after_editor() {
    			global $post;
    			$id = $post->ID;
    			echo '<div class="postbox" style="background:#0074a2;color:#fff;margin-top:20px;"><div class="inside">';
    			echo 'Instructions go here.';
    			echo '</div></div>';
    		}
    		add_action( 'edit_form_after_title', 'add_content_after_editor' );
    	}
    }
    add_action( 'admin_notices', 'options_instructions_example' );
  • I found the “current screen ID” (options page screen ID) by using this code:

    function find_current_screen_id() {
    	global $my_admin_page;
    	$screen = get_current_screen();
        echo $screen->id;
    }
    add_action( 'admin_notices', 'find_current_screen_id' );

    Unfortunately, I cannot place the “instructions box” under the page title “Global” (See image below). Any ideas?

    Instructions Box Above Title (Should Be Below)

  • A little late, if you are still looking for help or if someone else is looking for similar information.

    Usually you would create HTML on options pages by specifying a function to call in either add_options_page or add_submenu_page in WP. But you can’t include a function to call when using ACF options pages because ACF sets this function to its own function that adds ACF custom fields to the option page.

    The best option here is to use a message field at the top of your field group to give detailed instructions.

  • @john Huebner – What you suggested is what I wound up doing. I guess I forgot to post back here that I solved this. Thanks so much for your helpful suggestion!

  • Not a problem, I’m just trying to help out with clearing up questions here on the support forums and it was something I could answer.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.