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

How to set footer icons programatically in wordpress theme?

我想在 word press 的 2017 主题中以编程方式设置页脚图标,我创建了一个用于 add_menu_page 的页面并将其包含在 function.php 中,我希望 [=15] =] 定义了任何图标然后该图标显示在页脚中,任何人都可以帮我弄清楚吗?我在这里包括我的自定义页面代码:

<?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>';
}

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

用于保存数据

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 字段做同样的事情。我只是举了个例子。