diff --git a/functions.php b/functions.php index b474b58..3bef430 100644 --- a/functions.php +++ b/functions.php @@ -57,3 +57,8 @@ require get_template_directory() . '/inc/jetpack.php'; * Load custom WordPress nav walker. */ require get_template_directory() . '/inc/bootstrap-wp-navwalker.php'; + +/** +* Load WooCommerce functions. +*/ +require get_template_directory() . '/inc/woocommerce.php'; diff --git a/inc/bootstrap-wp-navwalker.php b/inc/bootstrap-wp-navwalker.php index e85ae87..e3f2f17 100644 --- a/inc/bootstrap-wp-navwalker.php +++ b/inc/bootstrap-wp-navwalker.php @@ -13,6 +13,7 @@ * Author: Edward McIntyre - @twittem * License: GPL-2.0+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt + * @package understrap */ //exit if accessed directly if(!defined('ABSPATH')) exit; diff --git a/inc/custom-header.php b/inc/custom-header.php index 37d78db..728985b 100644 --- a/inc/custom-header.php +++ b/inc/custom-header.php @@ -4,13 +4,13 @@ * http://codex.wordpress.org/Custom_Headers * * You can add an optional custom header image to header.php like so ... - - - - - - - +* +* +* +* +* +* +* * * @package understrap */ diff --git a/inc/enqueue.php b/inc/enqueue.php index a70a951..da5e629 100644 --- a/inc/enqueue.php +++ b/inc/enqueue.php @@ -1,4 +1,9 @@ ' . __('Read More', 'understrap') . '

'; diff --git a/inc/widgets.php b/inc/widgets.php index e9642f6..9e1e2b2 100644 --- a/inc/widgets.php +++ b/inc/widgets.php @@ -1,4 +1,10 @@ __( 'Sidebar', 'understrap' ), diff --git a/inc/woocommerce.php b/inc/woocommerce.php new file mode 100644 index 0000000..c789bba --- /dev/null +++ b/inc/woocommerce.php @@ -0,0 +1,12 @@ +api_url = $api_url; - $this->theme_slug = $theme_slug; - $this->license_key = $license_key; - - add_filter( 'pre_set_site_transient_update_themes', array(&$this, 'check_for_update') ); - - // This is for testing only! - //set_site_transient('update_themes', null); - } - - function check_for_update( $transient ) { - if (empty($transient->checked)) return $transient; - - $request_args = array( - 'id' => $this->theme_id, - 'slug' => $this->theme_slug, - 'version' => $transient->checked[$this->theme_slug] - ); - if ($this->license_key) $request_args['license'] = $this->license_key; - - $request_string = $this->prepare_request( 'theme_update', $request_args ); - $raw_response = wp_remote_post( $this->api_url, $request_string ); - - $response = null; - if( !is_wp_error($raw_response) && ($raw_response['response']['code'] == 200) ) - $response = unserialize($raw_response['body']); - - if( !empty($response) ) // Feed the update data into WP updater - $transient->response[$this->theme_slug] = $response; - - return $transient; - } - - function prepare_request( $action, $args ) { - global $wp_version; - - return array( - 'body' => array( - 'action' => $action, - 'request' => serialize($args), - 'api-key' => md5(home_url()) - ), - 'user-agent' => 'WordPress/'. $wp_version .'; '. home_url() - ); - } - - } -} \ No newline at end of file