Created
June 13, 2017 21:12
-
-
Save ashpriom/a684a99c6d3b94bcaadb96cfbd99a16d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'admin_init', 'theme_options_init' ); | |
add_action( 'admin_menu', 'theme_options_add_page' ); | |
function theme_options_init(){ | |
register_setting( 'sample_options', 'sample_theme_options'); | |
} | |
function theme_options_add_page() { | |
add_theme_page( __( 'Theme Options', 'sampletheme' ), __( 'Theme Options', 'sampletheme' ), 'edit_theme_options', 'theme_options', 'theme_options_do_page' ); | |
} | |
function theme_options_do_page() { | |
global $select_options; | |
if ( ! isset( $_REQUEST['settings-updated'] ) ) $_REQUEST['settings-updated'] = false; ?> | |
<div> | |
<?php screen_icon(); | |
echo "<h2>". __( 'Syn Studio Central Information Panel', 'customtheme' ) . "</h2>"; | |
echo "<h3>". __( 'Information entered here are distributed to all corresponding pages.', 'customtheme' ) . "</h2>"; | |
?> | |
<?php | |
if ( false !== $_REQUEST['settings-updated'] ) : ?> | |
<div> | |
<p><strong><?php _e( 'Options saved', 'customtheme' ); ?></strong></p></div> | |
<?php endif; ?> | |
<form method="post" action="options.php"> | |
<?php settings_fields( 'sample_options' ); ?> | |
<?php $options = get_option( 'sample_theme_options' ); ?> | |
<table> | |
<tr valign="top"><th scope="row"><?php _e( 'Class Registration Notice (English)', 'customtheme' ); ?></th> | |
<td> | |
<textarea id="sample_theme_options[deadline_en]" | |
class="large-text" cols="100" rows="3" placeholder="Example: Late Registration Deadline: Wednesday, July 8th, 11:59 P.M." name="sample_theme_options[deadline_en]"><?php echo esc_textarea( $options['deadline_en'] ); ?></textarea> | |
</td> | |
</tr> | |
<tr valign="top"><th scope="row"><?php _e( 'Class Registration Notice (French)', 'customtheme' ); ?></th> | |
<td> | |
<textarea id="sample_theme_options[deadline_fr]" | |
class="large-text" cols="100" rows="3" placeholder="Example: Date limite d\'inscription finale : mercredi 8 juillet à 23h59." name="sample_theme_options[deadline_fr]"><?php echo esc_textarea( $options['deadline_fr'] ); ?></textarea> | |
</td> | |
</tr> | |
</table> | |
<p> | |
<input type="submit" value="<?php _e( 'Save Options', 'customtheme' ); ?>" /> | |
</p> | |
</form> | |
</div> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment