Ok I have created a menu for my plugin settings:
add_action('admin_menu', 'woo_bpr_plugin_settings');
function woo_bpr_plugin_settings() {
add_menu_page('WooReviews', 'WooReviews', 'administrator', 'product_review_settings', 'woo_bpr_display_settings');
}
How do I now create the content for the plugin and then output that to a template file within my plugin.
e.g. I want to capture the following:
Additional product rating name:
then in the template file I want to output this:
Name of additional rating:
Yakir Sitbon answers:
Which template you have?
willcm comments:
single-product-reviews.php but I guess that doesn't matter?
Gabriel Reguly answers:
Hi,
This tutorial can help you:
[[LINK href="http://ottopress.com/2009/wordpress-settings-api-tutorial/"]]http://ottopress.com/2009/wordpress-settings-api-tutorial/[[/LINK]]
If you are willing to raise the price to $65 then I can code it for you :-)
Regards,
Gabriel
Arnav Joy answers:
here is the function which will display one field
add_action('admin_menu', 'woo_bpr_plugin_settings');
function woo_bpr_plugin_settings() {
add_menu_page('WooReviews', 'WooReviews', 'administrator', 'product_review_settings', 'woo_bpr_display_settings');
}
function woo_bpr_display_settings() {
if( $_POST['my_woo_review_settings'] == 'my_woo_review_settings' ) {
update_option('my_woo_review_settings',$_POST['product_review_settings']);
}
$product_review_settings = get_option('my_woo_review_settings');
?>
<div>
<h2>WooReviews Settings</h2>
<form action="<?php echo admin_url('admin.php?page=product_review_settings');?>" method="post">
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row">Enter Here</th>
<td>
<input id="product_review_settings" type="text" size="40" name="product_review_settings" value="<?php echo $product_review_settings ;?>">
</td>
</tr>
</tbody>
</table>
<input type="hidden" name="my_woo_review_settings" value="my_woo_review_settings" />
<input name="Submit" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" />
</form>
</div>
<?php
}
?>
and using following code you can retrieve its value:
<?php
$product_review_settings = get_option('my_woo_review_settings');
echo $product_review_settings;?>