Skip to content

Instantly share code, notes, and snippets.

@rmccue
Created June 10, 2013 00:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmccue/5745916 to your computer and use it in GitHub Desktop.
Save rmccue/5745916 to your computer and use it in GitHub Desktop.
Example of state management via Puppet for WooCommerce
<?php
class Tyuratam_CLI_WooCommerce extends WP_CLI_Command {
/**
* Installs the default WooCommerce pages
*/
public function install_pages() {
if ( ! get_option( 'skip_install_woocommerce_pages', 0 ) ) {
require_once( $GLOBALS['woocommerce']->plugin_path() . '/admin/woocommerce-admin-install.php' );
woocommerce_create_pages();
update_option('skip_install_woocommerce_pages', 1);
}
}
public function hide_notice() {
update_option('woocommerce_installed', 0);
}
}
WP_CLI::add_command( 'ty_woo', 'Tyuratam_CLI_WooCommerce' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment