I've followed this guide precisely: http://codex.wordpress.org/Creating_Options_Pages
However when I do do_settings_fields, it says:
Missing argument 2 for do_settings_fields()
Even though it says to put only one argument in there.
Strangely, the example given on that very same page says to use do_settings() - which appears to not even be a function!
Something tells me I need to create a 'section' as described here: http://codex.wordpress.org/Function_Reference/add_settings_section
But I'd rather find a quick fix for what I've already done. :)
EDIT I've been messing around with it for the past hour, and discovered several wordpress functions which apparently don't exist.. This is my latest code, which doesn't give me an errors, but also doesn't do anything apart from register the menu page:
<?php
// Register the menu
add_action('admin_menu', 'bang_menu');
function bang_menu() {
add_menu_page( 'BANG! Dashboard', 'BANG!', 'administrator', 'bang-admin', 'bang_dashboard');
}
// Register settings
add_action('admin_init', 'bang_settings');
function bang_settings() {
register_setting( 'bang-options-group', 'joinform_api_url' ); // Register the setting
add_settings_section( 'bang_section', 'Joinform configuration', null, 'section_options_page_type' ); // Register the section
add_settings_field( 'api_url', 'API URL', 'field_joinform_api_url', 'section_options_page_type', 'bang_section' ); // Define callback function for setting
}
function field_joinform_api_url() {
echo 'field here...';
}
function bang_dashboard() {
echo '
<div class="wrap">
<div class="postbox-container metabox-holder">
<div class="postbox">
<h3>Joinform configuration</h3>
<form action="options.php" method="post">';
settings_fields( 'bang-options-group' );
do_settings_sections( 'bang_section');
etc...
