Version Description
- Released 12 January 2017
- Adds the Genesis Connect Addons tab to the WooCommerce settings page.
- Adds an option to control the products to show per page on the Shop page template (can be overriden by theme).
- Removes the add_theme_support( 'genesis-connect-woocommerce' ); requirement.
- Update activation check function to only verify that Genesis is active.
Download this release
Release Info
Developer | nathanrice |
Plugin | Genesis Connect for WooCommerce |
Version | 0.9.9 |
Comparing to | |
See all releases |
Code changes from version 0.9.8 to 0.9.9
- genesis-connect-woocommerce.php +11 -26
- lib/posts-per-page.php +99 -0
- readme.txt +13 -12
genesis-connect-woocommerce.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Genesis Connect for WooCommerce
|
4 |
Plugin URI: http://www.studiopress.com/plugins/genesis-connect-woocommerce
|
5 |
-
Version: 0.9.
|
6 |
Author: StudioPress
|
7 |
Author URI: http://www.studiopress.com/
|
8 |
Description: Allows you to seamlessly integrate WooCommerce with the Genesis Framework and Genesis child themes.
|
@@ -20,34 +20,20 @@ register_activation_hook( __FILE__, 'gencwooc_activation' );
|
|
20 |
*
|
21 |
* Requirements:
|
22 |
* - WooCommerce needs to be installed and activated
|
23 |
-
* - Child theme needs to have add_theme_support( 'genesis-connect-woocommerce' ) in functions.php
|
24 |
*
|
25 |
* Note: register_activation_hook() isn't run after auto or manual upgrade, only on activation
|
26 |
-
* Note: this version of GCW is based on WooCommerce 1
|
27 |
*
|
28 |
* @since 0.9.0
|
29 |
*/
|
30 |
function gencwooc_activation() {
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
}
|
37 |
-
|
38 |
-
if ( ! current_theme_supports( 'genesis-connect-woocommerce' ) ) {
|
39 |
-
$message .= sprintf( '<br /><br />%s<br />%s', __( "Add this code to your child theme's functions.php:", 'gencwooc' ), "<code> add_theme_support( 'genesis-connect-woocommerce' );</code>" );
|
40 |
}
|
41 |
|
42 |
-
if ( ! empty( $message ) ) {
|
43 |
-
|
44 |
-
deactivate_plugins( plugin_basename( __FILE__ ) ); /** Deactivate ourself */
|
45 |
-
|
46 |
-
$message = __( 'Sorry! In order to use the Genesis Connect for WooCommerce plugin you need to do the following:', 'gencwooc' ) . $message;
|
47 |
-
|
48 |
-
wp_die( $message, 'Genesis Connect for WooCommerce Plugin', array( 'back_link' => true ) );
|
49 |
-
|
50 |
-
}
|
51 |
}
|
52 |
|
53 |
|
@@ -75,10 +61,6 @@ function gencwooc_setup() {
|
|
75 |
if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) )
|
76 |
return;
|
77 |
|
78 |
-
/** Fail silently if theme doesn't support GCW */
|
79 |
-
if ( ! current_theme_supports( 'genesis-connect-woocommerce' ) )
|
80 |
-
return;
|
81 |
-
|
82 |
/** Environment is OK, let's go! */
|
83 |
|
84 |
global $woocommerce;
|
@@ -86,10 +68,13 @@ function gencwooc_setup() {
|
|
86 |
/** Load GCW files */
|
87 |
require_once( GCW_LIB_DIR . '/template-loader.php' );
|
88 |
|
|
|
|
|
|
|
89 |
/** Load modified Genesis breadcrumb filters and callbacks */
|
90 |
if ( ! current_theme_supports( 'gencwooc-woo-breadcrumbs') )
|
91 |
require_once( GCW_LIB_DIR . '/breadcrumb.php' );
|
92 |
-
|
93 |
/** Ensure WooCommerce 2.0+ compatibility */
|
94 |
add_theme_support( 'woocommerce' );
|
95 |
|
@@ -111,4 +96,4 @@ function gencwooc_setup() {
|
|
111 |
if ( in_array( 'genesis-simple-menus/simple-menu.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) )
|
112 |
require_once( GCW_SP_DIR . '/genesis-simple-menus.php' );
|
113 |
|
114 |
-
}
|
2 |
/*
|
3 |
Plugin Name: Genesis Connect for WooCommerce
|
4 |
Plugin URI: http://www.studiopress.com/plugins/genesis-connect-woocommerce
|
5 |
+
Version: 0.9.9
|
6 |
Author: StudioPress
|
7 |
Author URI: http://www.studiopress.com/
|
8 |
Description: Allows you to seamlessly integrate WooCommerce with the Genesis Framework and Genesis child themes.
|
20 |
*
|
21 |
* Requirements:
|
22 |
* - WooCommerce needs to be installed and activated
|
|
|
23 |
*
|
24 |
* Note: register_activation_hook() isn't run after auto or manual upgrade, only on activation
|
25 |
+
* Note: this version of GCW is based on WooCommerce 2.1+
|
26 |
*
|
27 |
* @since 0.9.0
|
28 |
*/
|
29 |
function gencwooc_activation() {
|
30 |
|
31 |
+
//* If Genesis is not the active theme, deactivate and die.
|
32 |
+
if ( 'genesis' != get_option( 'template' ) ) {
|
33 |
+
deactivate_plugins( plugin_basename( __FILE__ ) );
|
34 |
+
wp_die( sprintf( __( 'Sorry, you can\'t activate unless you have installed <a href="%s">Genesis</a>', 'gencwooc' ), 'http://my.studiopress.com/themes/genesis/' ) );
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
|
39 |
|
61 |
if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) )
|
62 |
return;
|
63 |
|
|
|
|
|
|
|
|
|
64 |
/** Environment is OK, let's go! */
|
65 |
|
66 |
global $woocommerce;
|
68 |
/** Load GCW files */
|
69 |
require_once( GCW_LIB_DIR . '/template-loader.php' );
|
70 |
|
71 |
+
// Load posts per page option
|
72 |
+
require_once( GCW_LIB_DIR . '/posts-per-page.php' );
|
73 |
+
|
74 |
/** Load modified Genesis breadcrumb filters and callbacks */
|
75 |
if ( ! current_theme_supports( 'gencwooc-woo-breadcrumbs') )
|
76 |
require_once( GCW_LIB_DIR . '/breadcrumb.php' );
|
77 |
+
|
78 |
/** Ensure WooCommerce 2.0+ compatibility */
|
79 |
add_theme_support( 'woocommerce' );
|
80 |
|
96 |
if ( in_array( 'genesis-simple-menus/simple-menu.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) )
|
97 |
require_once( GCW_SP_DIR . '/genesis-simple-menus.php' );
|
98 |
|
99 |
+
}
|
lib/posts-per-page.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* These functions manage loading of plugin-specific addons to the WooCommerce
|
4 |
+
* settings page.
|
5 |
+
*
|
6 |
+
* @package genesis_connect_woocommerce
|
7 |
+
* @version 0.9.8
|
8 |
+
*
|
9 |
+
* @since 0.9.0
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Prevent direct access to this file
|
14 |
+
*/
|
15 |
+
if ( ! defined( 'ABSPATH' ) )
|
16 |
+
exit( _( 'Sorry, you are not allowed to access this file directly.' ) );
|
17 |
+
|
18 |
+
add_filter( 'woocommerce_settings_tabs_array', 'genesis_connect_addon_tab', 50 );
|
19 |
+
/*
|
20 |
+
* Add a custom tab in the WooCommerce settings for Genesis Connect.
|
21 |
+
*
|
22 |
+
* @since 1.0.0
|
23 |
+
* @return array $tabs Used to add a tab to the WooCommerce settings page.
|
24 |
+
*/
|
25 |
+
function genesis_connect_addon_tab( $tabs ) {
|
26 |
+
|
27 |
+
// Add our own section.
|
28 |
+
$tabs['gencwooc'] = __( 'Genesis Connect Addons', 'gencwooc' );
|
29 |
+
return $tabs;
|
30 |
+
|
31 |
+
}
|
32 |
+
|
33 |
+
add_action( 'woocommerce_settings_tabs_gencwooc', 'genesis_connect_settings_tab' );
|
34 |
+
/**
|
35 |
+
* Function to add our settings to the new tab.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
* @return array Multiple arrays holding our section information
|
39 |
+
*/
|
40 |
+
|
41 |
+
function genesis_connect_settings_tab() {
|
42 |
+
woocommerce_admin_fields( genesis_connect_get_settings() );
|
43 |
+
}
|
44 |
+
|
45 |
+
add_action( 'woocommerce_update_options_gencwooc', 'genesis_connect_update_settings' );
|
46 |
+
/**
|
47 |
+
* Update settings.
|
48 |
+
*
|
49 |
+
* @since 1.0.0
|
50 |
+
* @return array Settings to update.
|
51 |
+
*/
|
52 |
+
function genesis_connect_update_settings() {
|
53 |
+
woocommerce_update_options( genesis_connect_get_settings() );
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Helper function to hold an array of our settings.
|
58 |
+
*
|
59 |
+
* @since 1.0.0
|
60 |
+
* @return array $settings Array of our settings.
|
61 |
+
*/
|
62 |
+
function genesis_connect_get_settings() {
|
63 |
+
$settings = array(
|
64 |
+
'gencwooc_section_title' => array(
|
65 |
+
'name' => __( 'Genesis Connect Addons', 'gencwooc' ),
|
66 |
+
'type' => 'title',
|
67 |
+
'desc' => 'Set and save additional WooCommerce settings here.',
|
68 |
+
'id' => 'gencwooc_section_title'
|
69 |
+
),
|
70 |
+
'products_per_page' => array(
|
71 |
+
'name' => __( 'Products Per Page', 'gencwooc' ),
|
72 |
+
'type' => 'number',
|
73 |
+
'desc' => __( 'This setting determines how many products show up on archive pages and may be overridden by filters used in themes and plugins.', 'gencwooc' ),
|
74 |
+
'id' => 'gencwooc_products_per_page',
|
75 |
+
'default' => apply_filters( 'genesiswooc_default_products_per_page', get_option( 'posts_per_page' ) ),
|
76 |
+
),
|
77 |
+
'section_end' => array(
|
78 |
+
'type' => 'sectionend',
|
79 |
+
'id' => 'gencwooc_section_end'
|
80 |
+
)
|
81 |
+
);
|
82 |
+
return $settings;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Execute settings on the frontend (this should probably
|
87 |
+
* go somewhere else other than this file).
|
88 |
+
*
|
89 |
+
* @since 1.0.0
|
90 |
+
* @return array $q New query for the product page.
|
91 |
+
*/
|
92 |
+
add_filter( 'loop_shop_per_page', 'genesiswooc_products_per_page' );
|
93 |
+
function genesiswooc_products_per_page( $count ) {
|
94 |
+
|
95 |
+
$count = get_option( 'gencwooc_products_per_page' ) ? get_option( 'gencwooc_products_per_page' ) : apply_filters( 'genesiswooc_default_products_per_page', get_option( 'posts_per_page' ) );
|
96 |
+
|
97 |
+
return $count;
|
98 |
+
|
99 |
+
}
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: nathanrice, studiopress, studiograsshopper
|
3 |
Tags: genesis, genesiswp, studiopress, woocommerce
|
4 |
Requires at least: 3.3
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 0.9.
|
7 |
|
8 |
This plugin allows you to seamlessly integrate WooCommerce with the Genesis Framework and Genesis child themes.
|
9 |
|
@@ -22,18 +22,12 @@ Additionally, the plugin makes [Genesis Simple Sidebars](http://wordpress.org/ex
|
|
22 |
1. Upload the entire `genesis-connect-woocommerce` folder to the `/wp-content/plugins/` directory
|
23 |
2. DO NOT change the name of the `genesis-connect-woocommerce` folder
|
24 |
3. Activate the plugin through the 'Plugins' menu in WordPress
|
25 |
-
4. Add this code to your Genesis child theme's `functions.php` file: `add_theme_support( 'genesis-connect-woocommerce' );`
|
26 |
5. That's it. Navigate to your shop pages and you should see the new templates in action.
|
27 |
|
28 |
-
Note: You must have a Genesis child theme activated
|
29 |
|
30 |
== Frequently Asked Questions ==
|
31 |
|
32 |
-
= I've activated the plugin but it does not seem to do anything =
|
33 |
-
|
34 |
-
Make sure you have added this code to your Genesis child theme's `functions.php` file:
|
35 |
-
`add_theme_support( 'genesis-connect-woocommerce' );`
|
36 |
-
|
37 |
= Can I customize the Genesis Connect for Woocommerce templates? =
|
38 |
|
39 |
It's not recommended to customize the plugin's templates because, if you do, you will lose any customizations the next time the plugin is updated. Instead, take copies of the plugin's `single-product.php`, `archive-product.php` and `taxonomy.php` files, and place these copies in a folder called `woocommerce` in the root of your child theme's main folder, like this: `wp-content/themes/my-child-theme/woocommerce/`
|
@@ -78,7 +72,7 @@ If you are using a Genesis child theme specially designed for WooCommerce, refer
|
|
78 |
|
79 |
= Where is the plugin's settings page? =
|
80 |
|
81 |
-
There isn't one! This plugin does not need one as all of its work is behind the scenes, integrating the display of WooCommerce within Genesis themes.
|
82 |
|
83 |
|
84 |
== Other Notes ==
|
@@ -99,7 +93,7 @@ For more technically minded users, this is what the plugin does:
|
|
99 |
* unhook the Genesis Loop and replace it with the relevant WooCommerce shop loop
|
100 |
* remove WooCommerce's #container and #content divs, which are not required or wanted by Genesis
|
101 |
* The shop loop function in each template is heavily based on its WooCommerce counterpart, but has been modified to accommodate certain Genesis features such as the Taxonomy term headings and descriptions feature.
|
102 |
-
* The templates contain the `genesis();` function and therefore are fully customisable using Genesis hooks and filters.
|
103 |
* The template loader allows users to use their own templates in the child theme's 'woocommerce' folder. These user templates, if they exist in the child theme's `woocommerce' folder, will be loaded in place of the supplied Genesis Connect for WooCommerce templates
|
104 |
* Using appropriate filters, modifies the Genesis breadcrumbs output to mimic the breadcrumb structure provided by WooCommerce's built-in breadcrumbs.
|
105 |
|
@@ -141,6 +135,13 @@ For the benefit of theme developers and customizers, here is a summary of possib
|
|
141 |
|
142 |
== Changelog ==
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
= 0.9.8 =
|
145 |
* Released 9 July 2014
|
146 |
* Updates genesiswooc_content_product() to reflect WooC 2.1+ templates and correct handling of WooC's page title filter function
|
@@ -175,4 +176,4 @@ For the benefit of theme developers and customizers, here is a summary of possib
|
|
175 |
* Fixes call to undefined function error in sp-plugins-integration/genesis-simple-sidebars.php
|
176 |
|
177 |
= 0.9.0 =
|
178 |
-
* Initial Release
|
2 |
Contributors: nathanrice, studiopress, studiograsshopper
|
3 |
Tags: genesis, genesiswp, studiopress, woocommerce
|
4 |
Requires at least: 3.3
|
5 |
+
Tested up to: 4.7
|
6 |
+
Stable tag: 0.9.9
|
7 |
|
8 |
This plugin allows you to seamlessly integrate WooCommerce with the Genesis Framework and Genesis child themes.
|
9 |
|
22 |
1. Upload the entire `genesis-connect-woocommerce` folder to the `/wp-content/plugins/` directory
|
23 |
2. DO NOT change the name of the `genesis-connect-woocommerce` folder
|
24 |
3. Activate the plugin through the 'Plugins' menu in WordPress
|
|
|
25 |
5. That's it. Navigate to your shop pages and you should see the new templates in action.
|
26 |
|
27 |
+
Note: You must have a Genesis child theme activated before installing and activating this plugin.
|
28 |
|
29 |
== Frequently Asked Questions ==
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
= Can I customize the Genesis Connect for Woocommerce templates? =
|
32 |
|
33 |
It's not recommended to customize the plugin's templates because, if you do, you will lose any customizations the next time the plugin is updated. Instead, take copies of the plugin's `single-product.php`, `archive-product.php` and `taxonomy.php` files, and place these copies in a folder called `woocommerce` in the root of your child theme's main folder, like this: `wp-content/themes/my-child-theme/woocommerce/`
|
72 |
|
73 |
= Where is the plugin's settings page? =
|
74 |
|
75 |
+
There isn't one! This plugin does not need one as all of its work is behind the scenes, integrating the display of WooCommerce within Genesis themes.
|
76 |
|
77 |
|
78 |
== Other Notes ==
|
93 |
* unhook the Genesis Loop and replace it with the relevant WooCommerce shop loop
|
94 |
* remove WooCommerce's #container and #content divs, which are not required or wanted by Genesis
|
95 |
* The shop loop function in each template is heavily based on its WooCommerce counterpart, but has been modified to accommodate certain Genesis features such as the Taxonomy term headings and descriptions feature.
|
96 |
+
* The templates contain the `genesis();` function and therefore are fully customisable using Genesis hooks and filters.
|
97 |
* The template loader allows users to use their own templates in the child theme's 'woocommerce' folder. These user templates, if they exist in the child theme's `woocommerce' folder, will be loaded in place of the supplied Genesis Connect for WooCommerce templates
|
98 |
* Using appropriate filters, modifies the Genesis breadcrumbs output to mimic the breadcrumb structure provided by WooCommerce's built-in breadcrumbs.
|
99 |
|
135 |
|
136 |
== Changelog ==
|
137 |
|
138 |
+
= 0.9.9 =
|
139 |
+
* Released 12 January 2017
|
140 |
+
* Adds the Genesis Connect Addons tab to the WooCommerce settings page.
|
141 |
+
* Adds an option to control the products to show per page on the Shop page template (can be overriden by theme).
|
142 |
+
* Removes the add_theme_support( 'genesis-connect-woocommerce' ); requirement.
|
143 |
+
* Update activation check function to only verify that Genesis is active.
|
144 |
+
|
145 |
= 0.9.8 =
|
146 |
* Released 9 July 2014
|
147 |
* Updates genesiswooc_content_product() to reflect WooC 2.1+ templates and correct handling of WooC's page title filter function
|
176 |
* Fixes call to undefined function error in sp-plugins-integration/genesis-simple-sidebars.php
|
177 |
|
178 |
= 0.9.0 =
|
179 |
+
* Initial Release
|