首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在wordpress主题中编程设置页脚图标?

如何在wordpress主题中编程设置页脚图标?
EN

Stack Overflow用户
提问于 2017-09-06 13:06:11
回答 1查看 157关注 0票数 1

我想在word按下的二十七个主题中以编程方式设置页脚图标,我已经创建了一个用于add_menu_page的页面,并将其包含在function.php中,我希望在定义任何图标的链接时,该图标在页脚中显示,有人能帮助我找出它吗?我在这里包括我的自定义页面代码:

代码语言:javascript
复制
<?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>';
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-09-06 13:56:10

现在,只需将数据保存在wp_option表中,并在页脚中检索它。

用于保存数据

代码语言:javascript
复制
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并编写下面的代码

代码语言:javascript
复制
echo get_option('name'); 

注意:您需要对每个html字段执行相同的操作。我只给出了这个例子.

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46076084

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档