Wordpress D

Worldpress D

Now you have time to download WordPress! <font color="#ffff00">Presentation We are currently working on the change to the Settings API, which has been implemented in version 2.7.

First, you need to create the new menus and pages. For more information, see Migration of Plugins and Designs to 2. 7 and Settings API. 2. Once you have your page, you need to create a form in HTML with this code: the preference panes know which settings will manage your options page.

After opening the forms, add this function: settings_fields("myoption-group"); where myoption-group is the same name used in the register_setting utility. Used to replace the non-existent spell, actions and page_options fields that require the version 2.7 version of antiures. do_settings_fields('myoption-group'); Used to replace the shape fields tag in the shape itself.

Of course you have to close the tag according to your choices and if you want you can click the "Update Options" button. You can customize this button with the submit_button function. register_setting and unregister_setting for adding and removing items from a white list of permitted items that the template can store.

You can also designate a callback feature as a safety precaution to verify the value of each one. register_setting should be invoked in an administrator_init operation that precedes every administrator page and especially options.php that gets this page.

register_setting ('myoption-group','new_option_name');'register_setting('myoption-group','some_other_option');'register_setting('myoption-group','option_etc'); The name of the myoption-group does not play a role, but must correspond to the name in the above settings_fields functions. Use the following example to create an image for your option page [this works since 3.4. 2] In the following example the image will be saved in the folders "images" in the topic tree. add_action('admin_menu','baw_create_menu'); add_menu_page('BAW Plugin Settings', 'BAW Settings','administrator', __FILE__, 'baw_settings_page',plugins_url('/images/icon.

png', __FILE__)))) ; add_action('admin_init','register_mysettings')) ; register_setting('baw-settings-group','new_option_name') ; register_setting('baw-settings-group','some_other_option' ) ; register_setting('baw-settings-group','option_etc')) ; Dieses Beispiel funktioniert auf WP 3.5.

Name of the settings, the second parameters in the register_setting() command, MUST be the same as the name of the update item in the DB! If you have add_option('foo_bar','isfoo'), for example, you MUST use foo_bar as the second register_setting () argument.

Mehr zum Thema