Error in php code( building wordpress theme from scratch book) -
i following book building wordpress theme scratch.an options page created through method in wordpress admin panel .there error present due nothing appears inside it.
firsly added functions.php of wordpress:
<?php require_once('theme-options.php'); ?>
secondly theme-options.php created contains this:
<?php // create custom plugin settings menu add_action('admin_menu', 'director_create_menu'); function director_create_menu() { //create new submenu add_submenu_page( 'themes.php', 'director theme options', 'director options', 'administrator', __file__, 'wptuts_landing_settings_page'); //call register settings function add_action( 'admin_init', 'director_register_settings' ); } function director_register_settings() { //register our settings register_setting( 'director-settings-group', 'director_facebook' ); register_setting( 'director-settings-group', 'director_twitter' ); register_setting( 'director-settings-group', 'director_rss' ); register_setting( 'director-settings-group', 'director_logo' ); register_setting( 'director-settings-group', 'director_analytics' ); } function director_settings_page() { ?> <div class="wrap"> <h2>director theme settings</h2> <form id="landingoptions" method="post" action="options.php"> <?php settings_fields( 'director-settings-group' ); ?> <table class="form-table"> <tr valign="top"> <th scope="row">logo:</th> <td> <input type="text" name="director_logo" value="<?php print get_option('director_logo'); ?>" /> <br/> </td> </tr> <tr valign="top"> <th scope="row">facebook link:</th> <td> <input type="text" name="director_facebook" value="<?php print get_option('director_facebook'); ?>" /> </td> </tr> <tr valign="top"> <th scope="row">twitter link:</th> <td> <input type="text" name="director_twitter" value="<?php print get_option('director_twitter'); ?>" /> </td> </tr> <tr> <th scope="row">display rss icon:</th> <td> <input type="checkbox" name="director_rss" <?php if(get_option('director_rss') == true){ print "checked"; } ?> /> </td> </tr> <tr> <th scope="row">google analytics code:</th> <td> <textarea name="director_analytics"><?php print get_option('director_analytics'); ?></textarea> </td> </tr> </table> <p class="submit"> <input type="submit" class="button-primary" value="<?php _e('save changes') ?>" /> </p> </form> </div> <?php } ?>
the director options page created there nothing inside it.
the page should show this: page : please tell me problem , fix it.
i found solution , post else encounters problem.
there no wordpress error.however problem due add_submenu_page call function director_settings_page
should called instead of wptuts_landing_settings_page
.
Comments
Post a Comment