• Resolved Pcosta88

    (@pcosta88)


    Theme: 2012

    Hello!

    I am not sure why the options page fails to be shown. Here is the code used to build the page. In reading the codex it seems either I need to add a line somewhere (not sure what or where) or the examples I was following to help build my plugin are out-of-date and therefore the entire section needs to be rebuilt. Any guidance would be helpful.

    //action hook to add the post product menu item in the admin dashboard
    add_action('admin_menu','school_store_menu');
    
    //create submenu item
    function school_store_menu() {
    	add_options_page (__('School Store Settings Page', 'school-plugin'),
    		__('School Store Settings', 'school-plugin'),
    		'manage_options', 'school-store-settings', 'school_store_settings_page');
    }
    
    //build plugin settings page
    function school_store_settings_page()  {
    
    	//load the plugin array option
    	$ss_options_arr = get_option ('school_options');
    
    	//set the option array values to variables
    	$ss_inventory =(! empty ($ss_options_arr['show_inventory'] ) ) 
    
    	? $ss_options_arr ['show_inventory'] : '';
    	$ss_currency_sign = $ss_options_arr ['currency_sign'];
    ?>
    <div class="wrap">
    <h2> <?php _e ('School Store Options', 'school-plugin') ?> </h2>
    <form action="options.php" method ="post" >
    <?php settings_fields ('school-settings-group'); ?>
    <table class="form-table">
    <tr valign="top">
    <th scope="row"> <?php _e ('Show Product Inventory', 'school-plugin') ?> </th>
    <td> <input type="checkbox" name="school_options[show_inventory]" <?php echo checked ($ss_inventory,'on'); ?> /> </td>
     </tr>
     <tr valign="top">
     <th scope="row"> <?php _e ('Currency Sign', 'school-plugin') ?> </th>
     <td> <input type="text" name="school_options[currency_sign]" value="<?php echo esc_attr ( $ss_currency_sign); ?>"
     size="1" maxlength="1"  />  </td>
     </tr>
     </table>
    
    <p class="submit">
    <input type="submit" class="button-primary" value="<?php _e ('Save Changes', 'school-plugin') ?>" />
    </p>
    </form>
    </div>
    <?php
    }
Viewing 1 replies (of 1 total)
  • Thread Starter Pcosta88

    (@pcosta88)

    I was able to fix this problem by making sure the options-group in the settings_field matched an earlier array.

Viewing 1 replies (of 1 total)
  • The topic ‘Error: Options Page Not Found’ is closed to new replies.