
內容簡介
此外掛可讓您基於 AJAX 創建美麗的選項頁面。
注意:此外掛專為開發人員而製作。如果您不是主題或外掛的開發人員,請向您的開發人員請求。
設置
創建名為“options.php”的文件。
將以下內容添加到您的functions.php 或 plugin.php中。
< ? php // 檢查外掛是否存在
if(function_exists ('create_vtl_options_page')){
include('options.php');
add_action('admin_menu', 'register_options_pages');
} else {
function vtco_error_notice() {
echo '
' . __('您需要安裝外掛“vir2al options”', 'text-domain') . '。
';
}
add_action('admin_notices', 'vtco_error_notice');
} ?>
options.php
<? php
function vtco_register_settings_pages(){
// 在此添加任何您想要的頁面
add_options_page( '額外選項', '額外選項', 'manage_options', 'addoptions', 'options_cbfunc');
}
function options_cbfunc(){
ob_start();
// 創建您的表單 ?>
<fieldset data-name="選項卡 1">
<table>
<tr>
<td>測試</td>
<td><?php echo get_vtlo_input('選項名稱'); ?></td>
</tr>
</table>
</fieldset>
<fieldset data-name="選項卡 2">
<table>
<tr>
<td>測試圖像</td>
<td><?php echo get_vtlo_imgupload('選項名稱_圖像'); ?></td>
</tr>
</table>
</fieldset>
<?php
$html=ob_get_contents();
ob_end_clean();
// 執行魔法
return create_vtl_options_page($html);
}
?>
可能的輸入
文本區: get_vtlo_textarea(名稱);
輸入框: get_vtlo_input(名稱);
選擇框: get_vtlo_select(名稱, 選項陣列);
圖像: get_vtlo_imgupload(名稱);
多圖像: get_vtlo_multiimgupload(名稱);
顏色輸入:get_vtlo_colorinput(名稱, 默認顏色);
外掛標籤
開發者團隊
原文外掛簡介
This Plugin let’s you create an beautiful options page based on AJAX.
Note: This PlugIn is made for Developers only. If you are not the Developer of the theme or plugin. Ask your developer.
SetUp
Create a File called “options.php”.
Add the following to your functions.php or plugin.php
< ?php //check if plugin exists
if(function_exists ('create_vtl_options_page')){
include('options.php');
add_action('admin_menu', 'register_options_pages');
} else {
function vtco_error_notice() {
echo '
‘.__(‘You need to Install the Plugin “vir2al options”‘).’
‘;
}
add_action( ‘admin_notices’, ‘vtco_error_notice’ );
} ?>
options.php
Possible inputs
Textarea: get_vtlo_textarea(name);
Input: get_vtlo_input(name);
Select: get_vtlo_select(name,options_array);
IMG: get_vtlo_imgupload(name);
Multi IMG: get_vtlo_multiimgupload(name);
Colorinput: get_vtlo_colorinput(name,default_color);
