我想在word按下的二十七个主题中以编程方式设置页脚图标,我已经创建了一个用于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>';
}发布于 2017-09-06 13:56:10
现在,只需将数据保存在wp_option表中,并在页脚中检索它。
用于保存数据
add_action('init','saveCustomData');
function saveCustomData()
{
if(!is_admin()){
return;
}
if(isset($_REQUEST['submit']))
{
//change the name in your html
update_option('name',$_REQUEST['name'],true);
}
}现在,要在页脚中显示,请到您的footer.php并编写下面的代码
echo get_option('name'); 注意:您需要对每个html字段执行相同的操作。我只给出了这个例子.
https://stackoverflow.com/questions/46076084
复制相似问题