-
-
Save tommcfarlin/f72e1444fb01cff19de2c58f0aacab34 to your computer and use it in GitHub Desktop.
[WordPress]
This file contains 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
<?php | |
public function display() | |
{ | |
include_once $this->pluginPath . 'views/acme-settings.php'; | |
} |
This file contains 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
<?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> | |
This file contains 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
<?php | |
public function showSuccessMessage() | |
{ | |
return (false !== get_option('acme_custom_setting')); | |
} |
This file contains 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
<?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