[WordPress]
<?php | |
public function display() | |
{ | |
include_once $this->pluginPath . 'views/acme-settings.php'; | |
} |
<?php | |
/** | |
* Renders the settings page for the plugin. | |
*/ | |
?> | |
<div class="wrap"> | |
<h1 class="wp-heading-inline"><?php echo get_admin_page_title(); ?></h1> | |
<?php if ($this->showSuccessMessage()) { ?> | |
<?php include_once 'partials/settings-saved.php'; ?> | |
?> | |
<div id="acme-settings-schedule"> | |
<form id="acme-form" method="post" action="<?php echo esc_html(admin_url('admin-post.php')); ?>""> | |
<!-- This is where your settings go. --> | |
<p> | |
<?php | |
submit_button( | |
'Save', | |
'primary', | |
'acme-save-settings', | |
false | |
); | |
wp_nonce_field( | |
'acme-save', | |
'acme-save-nonce' | |
); | |
?> | |
</p> | |
</form> | |
</div> | |
</div> | |
<?php | |
public function showSuccessMessage() | |
{ | |
return (false !== get_option('acme_custom_setting')); | |
} |
<?php | |
/** | |
* Renders the success message if the option has been properly saved. | |
*/ | |
?> | |
<div class="notice-success notice is-dismissible"> | |
<p>Your settings have been successfully saved.</p> | |
<button type="button" class="notice-dismiss"> | |
<span class="screen-reader-text">Dismiss this notice.</span> | |
</button> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment