【发布时间】:2018-02-14 23:53:56
【问题描述】:
我想在 word press 的 27 个主题中以编程方式设置页脚图标,我创建了一个用于 add_menu_page 的页面并将其包含在 function.php 中,我希望在定义任何图标的链接时显示该图标在页脚中,任何人都可以帮我弄清楚吗?我在这里包括我的自定义页面代码:
<?php
function theme_options_panel(){
add_menu_page('Theme page title', 'My Setting', 'manage_options', 'theme-options', 'wps_theme_func');
add_submenu_page( 'theme-options', 'Settings page title', 'Demo menu', 'manage_options', 'theme-op-settings', 'wps_theme_func_settings');
add_submenu_page( 'theme-options', 'FAQ page title', 'FAQ menu', 'manage_options', 'theme-op-faq', 'wps_theme_func_faq');
}
add_action('admin_menu', 'theme_options_panel');
function wps_theme_func(){?>
<form action="" id="frontpostform" method="post" style="margin: 7% 0% 0% 10%;" >
<h1> Custom Footer icon Setting </h1> <br/>
<label>Footer facebook Icon url: </label>
<input type="text" name="name" id="name" value="http://" required="required"> <br/><br/>
<label>Footer Twitter Icon url: </label>
<input type="text" name="name" id="name" value="http://" required="required"> <br/><br/>
<label>Footer instagram Icon url: </label>
<input type="text" name="name" id="name" value="http://" required="required"> <br/><br/>
<label>Footer google+ Icon url: </label>
<input type="text" name="name" id="name" value="http://" required="required"> <br/><br/>
<input type="submit" name="submit" value="Submit" style="margin-left: 10%">
</form>
<?php }
function wps_theme_func_settings(){
echo '<div class="wrap"><div id="icon-options-general" class="icon32"><br></div>
<h2>Demo text</h2></div>';
}
function wps_theme_func_faq(){
echo '<div class="wrap"><div id="icon-options-general" class="icon32"><br></div>
<h2>FAQ</h2></div>';
}
【问题讨论】:
-
为什么不使用定制器?