Skip to content

Instantly share code, notes, and snippets.

@vorvulev
Created January 11, 2016 19:58
Show Gist options
  • Save vorvulev/ac44b83d607aa280f27a to your computer and use it in GitHub Desktop.
Save vorvulev/ac44b83d607aa280f27a to your computer and use it in GitHub Desktop.
Custom text fields WordPress
<?php
//Custom Theme Settings add this to functions.php
add_action('admin_menu', 'add_gcf_interface');
function add_gcf_interface() {
add_menu_page('Дополнительная информация', 'Дополнительная информация', '5', 'functions', 'editglobalcustomfields','dashicons-phone',"3.1");
}
function editglobalcustomfields() { ?>
<div class='wrap'>
<h2>Дополнительная информация</h2>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<p><strong>Контактный телефон:</strong><br />
<input type="text" name="mytel" size="50" value="<?php echo get_option('mytel'); ?>" /></p>
<p><strong>Адрес:</strong><br />
<input type="text" name="myadr" size="50" value="<?php echo get_option('myadr'); ?>" /></p>
<p><input type="submit" name="Submit" value="Обновить" /></p>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="mytel,myadr" />
</form>
</div>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment