אתר נחמד ליצור בקלות שדות נוספים
http://wpsettingsapi.jeroensormani.com/
/*
Plugin Name: General Settings Linkin
Plugin URI: https://link-in.co.il
Description: הוספת שדות להגדרות הכלליות של האתר
Version: 1.0
Author: Tzur bracha
Author URI: https://link-in.co.il
License: GPL2 etc
*/
add_action( 'admin_menu', 'General_Settings_add_admin_menu' );
add_action( 'admin_init', 'General_Settings_settings_init' );
function General_Settings_add_admin_menu( ) {
add_options_page( 'הגדרות כלליות', 'הגדרות כלליות', 'manage_options', 'general_settings', 'General_Settings_options_page' );
}
function General_Settings_settings_init( ) {
register_setting( 'pluginPage', 'General_Settings_settings' );
add_settings_section(
'General_Settings_pluginPage_section',
__( 'הגדרות נוספת לתבנית', 'הגדרות כלליות' ),
'General_Settings_settings_section_callback',
'pluginPage'
);
add_settings_field(
'General_Settings_text_field_0',
__( 'הכנס מינימום להזמנה במשלוח', 'הגדרות כלליות' ),
'General_Settings_text_field_0_render',
'pluginPage',
'General_Settings_pluginPage_section'
);
}
function General_Settings_text_field_0_render( ) {
$options = get_option( 'General_Settings_settings' );
?>
<input type='text' name='General_Settings_settings[General_Settings_text_field_0]' value='<?php echo $options['General_Settings_text_field_0']; ?>'>
<?php } function General_Settings_settings_section_callback( ) { // echo __( 'This section description', 'הגדרות כלליות' ); } function General_Settings_options_page( ) { ?>
<form action='options.php' method='post'>
<h2>הגדרות כלליות</h2>
<?php settings_fields( 'pluginPage' ); do_settings_sections( 'pluginPage' ); submit_button(); ?>
</form>
<?php
}