Setting for product post type slug

- New priority in slug generation: Shop base (if checked), custom slug
(if entered), pick default (translatable) 'product'
- Related to: #1579
This commit is contained in:
Coen Jacobs 2012-10-09 18:05:29 +02:00
parent 5868b63b93
commit e159952841
3 changed files with 38 additions and 19 deletions

View File

@ -385,6 +385,34 @@ $woocommerce_settings['pages'] = apply_filters('woocommerce_page_settings', arra
array( 'name' => __( 'Permalinks', 'woocommerce' ), 'type' => 'title', 'desc' => '', 'id' => 'permalink_options' ),
array(
'name' => __( 'Product base category', 'woocommerce' ),
'desc' => __( 'Prepend product permalinks with product category', 'woocommerce' ),
'id' => 'woocommerce_prepend_category_to_products',
'std' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'start'
),
array(
'name' => __( 'Product base page', 'woocommerce' ),
'desc' => sprintf(__( 'Prepend product permalinks with shop base page (<code>%s</code>)', 'woocommerce' ), $base_slug) . $woocommerce_prepend_shop_page_to_products_warning,
'id' => 'woocommerce_prepend_shop_page_to_products',
'std' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end'
),
array(
'name' => __( 'Product slug', 'woocommerce' ),
'desc' => __( 'Shows in the single product URLs. Leave blank to use the default slug. Can only be used if shop base page isn\'t prepended.', 'woocommerce' ),
'id' => 'woocommerce_product_slug',
'type' => 'text',
'css' => 'min-width:300px;',
'std' => '',
'desc_tip' => true,
),
array(
'name' => __( 'Taxonomy base page', 'woocommerce' ),
'desc' => sprintf(__( 'Prepend shop categories/tags with shop base page (<code>%s</code>)', 'woocommerce' ), $base_slug),
@ -413,24 +441,6 @@ $woocommerce_settings['pages'] = apply_filters('woocommerce_page_settings', arra
'desc_tip' => true,
),
array(
'name' => __( 'Product base page', 'woocommerce' ),
'desc' => sprintf(__( 'Prepend product permalinks with shop base page (<code>%s</code>)', 'woocommerce' ), $base_slug) . $woocommerce_prepend_shop_page_to_products_warning,
'id' => 'woocommerce_prepend_shop_page_to_products',
'std' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start'
),
array(
'name' => __( 'Product base category', 'woocommerce' ),
'desc' => __( 'Prepend product permalinks with product category', 'woocommerce' ),
'id' => 'woocommerce_prepend_category_to_products',
'std' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'end'
),
array( 'type' => 'sectionend', 'id' => 'permalink_options' ),
array( 'name' => __( 'Shop Pages', 'woocommerce' ), 'type' => 'title', 'desc' => __( 'The following pages need selecting so that WooCommerce knows where they are. These pages should have been created upon installation of the plugin, if not you will need to create them.', 'woocommerce' ) ),

View File

@ -169,6 +169,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Feature - Schedule sales for variations.
* Feature - Expanded bulk edit for prices. Change to, increase by, decrease by.
* Feature - Set attribute order (globally, per attribute).
* Feature - Allow setting the product post type slug to a static (non-translatable) text, mainly to be used for translating and WPML setups.
* Templating - email-order-items.php change get_downloadable_file_url() to get_downloadable_file_urls() to support multiple files.
* Templating - loop-end and start for product loops, allow changing the UL's used by default to something else.

View File

@ -631,7 +631,15 @@ class Woocommerce {
$tag_slug = ( get_option('woocommerce_product_tag_slug') ) ? get_option('woocommerce_product_tag_slug') : _x('product-tag', 'slug', 'woocommerce');
$product_base = ( get_option('woocommerce_prepend_shop_page_to_products') == 'yes' ) ? trailingslashit($base_slug) : trailingslashit(_x('product', 'slug', 'woocommerce'));
if ( 'yes' == get_option('woocommerce_prepend_shop_page_to_products') ) {
$product_base = trailingslashit( $base_slug );
} else {
if ( ( $product_slug = get_option('woocommerce_product_slug') ) !== false && ! empty( $product_slug ) ) {
$product_base = trailingslashit( $product_slug );
} else {
$product_base = trailingslashit( _x('product', 'slug', 'woocommerce') );
}
}
if ( get_option('woocommerce_prepend_category_to_products') == 'yes' ) $product_base .= trailingslashit('%product_cat%');