New Top level Menu Not Displaying
-
I’m not fully understanding how to code theme options admin menus. Mine is currently displaying only the h2 tag “Cleancut Theme Options” and the submit button from this code. Any help or tutorial would be helpful. Thanks
add_action( 'admin_menu', 'cleancut_menu'); function cleancut_menu() { add_menu_page( __('Cleancut Framework', 'cleancut'), __('Cleancut', 'cleancut'), 'manage_options', 'cleancutmenu', 'cleancutmenu_display', '' //last option is icon URL ); } function cleancut_init() { add_settings_section( 'options_section', //ID for section 'Main Options', //Title 'cleancutmenu_description_display', //Render options function 'cleancutmenu' //ID of page where section is rendered ); add_settings_field( 'font', //Id to use for this section in attribute tags 'Font', //ID to use for this section in attribute tags 'font_display', //Function used to render options for this section 'cleancutmenu', //ID of page on which this section is rendered 'options_section' //The section to which this field belongs ); register_setting( 'options_section', 'font_options' ); } add_action( 'admin_init', 'cleancut_init' ); // CALLBACKS function cleancutmenu_description_display() { echo '<h2>' . __( 'Test Settings', 'cleancut' ) . '</h2>'; } function font_display() { $options = (array)get_option( 'font_options' ); $display = $options['display']; $html = '<label for="font_options[display]">'; $html .= '<input type="text" name="font_options[display]" id="font_options[display]" . />'; $html .= '?'; $html .= 'Select a font: '; $html .= '</label>'; echo $html; } function cleancutmenu_display() { ?> <div class="wrap"> <div id="icon-options-general" class="icon32"></div> <h2> Cleancut Theme Options</h2> <form method="post" action="options.php"> <?php //Render the settings for the settings section indentified as Font Options settings_fields( 'options_section' ); //Renders all of the settings for the "cleancutmenu" section do_settings_sections('font' ); // Add the submit button submit_button(); ?> </form> </div> <!--end wrap--> <?php }
- The topic ‘New Top level Menu Not Displaying’ is closed to new replies.