WordPress主题选项页面根本不显示

时间:2014-01-21 15:02:09

标签: php html wordpress

我最近能够解决我之前在主题选项页面上遇到的错误的问题,但现在我遇到了另一个问题。

当这段代码正确地包含在我的functions.php文件中时,它会显示在侧栏上,一切都很好,没有错误或任何东西!但是,它没有显示我的任何选择,而且,我不知道他们是否会工作,即使他们会显示,因为我无法测试它!

以下是代码:

<?php
add_action( 'admin_menu', 'where_now_menu' );

function register_mysettings() {
//register our settings
register_setting( 'where-now-settings-group', 'site-logo-url' );
register_setting( 'where-now-settings-group', 'google-analytics' );
}

function where_now_menu() {
add_menu_page( 'Front Door Theme Options', 'Front Door Theme Options', 'manage_options', 'where_now_options', 'where_now_options' );
}

function where_now_options() {
if ( !current_user_can( 'manage_options' ) )  {
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
}
}
?>

<?php function where_now_settings_page(){ ?>
<div class="wrap">
<h2>Front Door Custom Theme Options</h2>
<form method="post" action="theme-options.php">
<?php settings_fields( 'where-now-settings-group' ); ?>
    <?php do_settings_sections( 'where-now-settings-group' ); ?>
<h3>Site Logo URL</h3><input name="site_logo" type="text" value="<?php echo get_option('site-logo-url'); ?>">
<p>(Hint: A good way to make sure that you will always have this image on your site, upload it to your Wordpress Media section, then grad the URL from the image. Insert that URL to make sure that the location of the image will not change.)</p>
<h3>Google Analytics Tracking Code</h3><input name="analytics_tracking_code" type="textarea" rows="20" cols="20" value="<?php echo get_option('google-analytics'); ?>"></br>
<?php submit_button(); ?>
</form>
</div>
<?php } ?>

有什么想法吗?

0 个答案:

没有答案