我通过设置页面创建了一个供内部使用的小插件。 如下:
<div class="wrap">
<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
<form method="post" name="desite_options" action="options.php">
<?php
//Grab all options
$options = get_option($this->plugin_name);
// Desite
$credit = $options['credit'];
$logo_link = $options['logo_link'];
$logo_alt = $options['logo_alt'];
$dashboard_welcome = $options['dashboard_welcome'];
$acf_settings = $options['acf_settings'];
$acf_map = $options['acf_map'];
$acf_map_key = $options['acf_map_key'];
$ocean_rtl = $options['ocean_rtl'];
?>
<?php
settings_fields($this->plugin_name);
do_settings_sections($this->plugin_name);
?>
<h3>Admin Customization</h3>
<fieldset>
<legend class="screen-reader-text">
<span>Add desite's credit</span>
</legend>
<label for="<?php echo $this->plugin_name; ?>-credit">
<input type="checkbox" id="<?php echo $this->plugin_name; ?>-credit" name="<?php echo $this->plugin_name; ?>[credit]" value="1" <?php checked($credit, 1); ?> />
<span><?php esc_attr_e('Add desite credit', $this->plugin_name); ?></span>
</label>
</fieldset>
<?php submit_button('Save all changes', 'primary','submit', TRUE); ?>
</form>
我设法保存了选择并清理了字段。 选中复选框时,我在运行功能时遇到困难。 例如: 我具有以下功能:
function remove_footer_admin() {
echo 'Site built for Bhuka Tours by <a href="https://desite.co.il/">DEsite</a>'; }
add_filter('admin_footer_text', 'remove_footer_admin');
检查$ credit以及在哪个文件中效果最好,我需要做什么才能执行此功能? 谢谢。