Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding plugin settings section and a setting for changing the product… #4

Merged
merged 1 commit into from Jun 23, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -37,6 +37,10 @@
'can_export' => true,
)
);
add_option( 'amazin_product_box_option_headline', 'We recommend');
register_setting( 'amazin_product_box_options_group', 'amazin_product_box_option_headline', 'amazin_product_box_callback' );
new Amazin_Product_Box_Admin_Menu();
});
@@ -62,7 +66,7 @@ function amazin_product_box_render_in_post($productBox) {
$content = json_decode($stripped, true);
?>
<div class="amazin-product-box" id="<?php echo 'amazin-product-box-id-'.$id; ?>">
<p class="amazin-product-box-recommend-text">We recommend</p>
<p class="amazin-product-box-recommend-text"><?php echo get_option('amazin_product_box_option_headline'); ?></p>
<h3 class="amazin-product-box-product-name"><?php echo $productBoxTitle ?></h3>
<div class="row amazin-product-box-image-row">
<div class="amazin-product-box-column amazin-product-box-left">
@@ -25,7 +25,6 @@ public function admin_menu() {
add_submenu_page( 'amazinProductBox', __( 'AmazinProductBox', 'apb' ), __( 'AmazinProductBox', 'apb' ), 'manage_options', 'amazinProductBox', array( $this, 'plugin_page' ) );
wp_enqueue_media();
}
/**
@@ -18,4 +18,23 @@
$list_table->display();
?>
</form>

<form method="post" action="options.php">
<?php settings_fields( 'amazin_product_box_options_group' ); ?>
<h3>Product box settings</h3>
<p>These settings are shared by all product boxes on your site.</p>
<table>
<tr valign="top">
<th scope="row">
<label for="amazin_product_box_option_headline">Product Box Headline</label>
</th>
<td>
<input type="text" id="amazin_product_box_option_headline" name="amazin_product_box_option_headline" value="<?php echo get_option('amazin_product_box_option_headline'); ?>" />
<br/>
<span class="description"><?php _e('Examples: "We recommend", "Our pick", "A Sitename Favorite", etc.', 'apb' ); ?></span>
</td>
</tr>
</table>
<?php submit_button(); ?>
</form>
</div>
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.