Add button on tools page to create missing pages

This commit is contained in:
Gerhard 2013-11-14 21:20:18 +02:00
parent 3793382775
commit 3607ecf285
3 changed files with 12 additions and 2 deletions

View File

@ -121,9 +121,13 @@ class WC_Admin_Status {
" );
wp_cache_flush();
echo '<div class="updated"><p>' . __( 'Sessions successfully cleared', 'woocommerce' ) . '</p></div>';
break;
case "install_pages" :
WC_Install::create_pages();
echo '<div class="updated"><p>' . __( 'All missing WooCommerce pages was installed successfully.', 'woocommerce' ) . '</p></div>';
break;
default:
$action = esc_attr( $_GET['action'] );
if( isset( $tools[ $action ]['callback'] ) ) {
@ -177,6 +181,11 @@ class WC_Admin_Status {
'button' => __('Clear all sessions','woocommerce'),
'desc' => __( '<strong class="red">Warning</strong> This tool will delete all customer session data from the database, including any current live carts.', 'woocommerce' ),
),
'install_pages' => array(
'name' => __( 'Install WooCommerce Pages', 'woocommerce' ),
'button' => __( 'Install pages', 'woocommerce' ),
'desc' => __( '<strong class="red">Note</strong> This tool will install all the missing WooCommerce pages. Pages already defined and set up will not be replaced.', 'woocommerce' ),
),
) );
}

View File

@ -203,7 +203,7 @@ class WC_Install {
* @access public
* @return void
*/
private function create_pages() {
public function create_pages() {
$pages = apply_filters( 'woocommerce_create_pages', array(
'shop' => array(
'name' => _x( 'shop', 'page_slug', 'woocommerce' ),

View File

@ -187,6 +187,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Feature - Standardized, default credit card form for gateways to use if they support 'default_credit_card_form'.
* Feature - Coupon usage limits per user (using email + ID).
* Feature - Option to limit reviews to purchasers.
* Feature - Option to install missing WooCommerce pages from tools page.
* Tweak - Added pagination to tax rate screens.
* Tweak - Added filter to check the 'Create account' checkbox on checkout by default.
* Tweak - Update CPT parameters for 'product_variation' and 'shop_coupon' to be no longer public.