Skip to content

Instantly share code, notes, and snippets.

Created January 30, 2018 16:30
What would you like to do?
[WordPress] Templating and Conditional Logic with OOP
<div class="wrap">
<!-- Snipping out irrelevant code in this file -->
<form id="yhd-upload-new-item-settings">
<?php if (!$this->hasSecondaryPlugin()) { ?>
<?php include_once 'partials/error-inactive-plugin.php'; ?>
<?php } else { ?>
<h2>Secondary Plugin Settings</h2>
<p class="description">The Secondary Plugin is installed and active.</p>
<form method="post" action="<?php echo esc_html(admin_url('admin-post.php')); ?>">
<label for="acme-secondary-plugin">
<input type="checkbox" name="acme-secondary-plugin" value="true"/>
Would you like to automatically use the secondary plugin?
<!-- Snipping out irrelevant code in this file -->
<?php } ?>
* This is the partial displayed when the Secondary Plugin is not active.
<div id="inactive-importer-message" class="error notice is-dismissible">
<p>[The message you want to display here.]</p>
<button type="button" class="notice-dismiss">
<span class="screen-reader-text">Dismiss this notice.</span>
</div><!-- #inactive-importer-message -->
* Determines if the Secondary Importer is is activated.
* @return bool True if the the pklugin is active; false, otherwise.
private function hasSecondaryPlugin()
return in_array(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment