Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function sync_settings_page() { ?>
- <div class="wrap">
- <h1>Theme Settings</h1>
- <p>This information will be used across your website. Please ensure the correct details have been used.</p>
- <?php
- echo '<div><div class="postbox"><div class="inside"><form method="post" action="options.php">';
- do_settings_sections("sync-options");
- settings_fields("sync-settings");
- submit_button();
- echo '</form></div></div></div>';
- ?>
- </div>
- <?php }
- function display_environments() {
- $checked = null;
- $environments = get_option('environments');
- if ( $environments == true ) {
- $checked = 'checked';
- }
- echo '<label for="environments"><input type="checkbox" '.$checked.' name="environments" id="environments" value="1"> <span class="description">Show Navigation in header?</span></label>';
- }
- /**
- * display sync options
- */
- function display_sync_options(){
- // sections
- add_settings_section("environment-section", "Environments", null, "sync-options");
- // options
- add_settings_field("environments", "Show Navigation?", "display_environments", "sync-options", "environment-section");
- // register
- register_setting("sync-settings", "environments");
- }
- add_action("admin_init", "display_sync_options");
- /**
- * setup admin menu
- */
- function add_sync_menu(){
- add_options_page("Sync Options", "Sync Options", "manage_options", "sync-options", "sync_settings_page");
- }
- add_action("admin_menu", "add_sync_menu");
- /**
- * enqueue admin scripts
- */
- function enqueue_admin() {
- if ( isset($_GET['page']) && $_GET['page'] == 'sync-options' ) {
- // media
- wp_enqueue_media();
- // admin scripts
- wp_register_script('theme-js', get_template_directory_uri() . '/admin-js/theme.js', array('jquery'), null, true );
- wp_enqueue_script('theme-js');
- }
- }
- // add_action("admin_init", "enqueue_admin");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement