diff --git a/includes/admin/class-wc-admin-permalink-settings.php b/includes/admin/class-wc-admin-permalink-settings.php index 08594b93939..42bcdf87b12 100644 --- a/includes/admin/class-wc-admin-permalink-settings.php +++ b/includes/admin/class-wc-admin-permalink-settings.php @@ -13,7 +13,9 @@ if ( ! defined( 'ABSPATH' ) ) { exit; } -if ( ! class_exists( 'WC_Admin_Permalink_Settings', false ) ) : +if ( class_exists( 'WC_Admin_Permalink_Settings', false ) ) { + return new WC_Admin_Permalink_Settings(); +} /** * WC_Admin_Permalink_Settings Class. @@ -39,30 +41,28 @@ class WC_Admin_Permalink_Settings { * Init our settings. */ public function settings_init() { - // Add a section to the permalinks page add_settings_section( 'woocommerce-permalink', __( 'Product permalinks', 'woocommerce' ), array( $this, 'settings' ), 'permalink' ); - // Add our settings add_settings_field( - 'woocommerce_product_category_slug', // id - __( 'Product category base', 'woocommerce' ), // setting title - array( $this, 'product_category_slug_input' ), // display callback - 'permalink', // settings page - 'optional' // settings section + 'woocommerce_product_category_slug', + __( 'Product category base', 'woocommerce' ), + array( $this, 'product_category_slug_input' ), + 'permalink', + 'optional' ); add_settings_field( - 'woocommerce_product_tag_slug', // id - __( 'Product tag base', 'woocommerce' ), // setting title - array( $this, 'product_tag_slug_input' ), // display callback - 'permalink', // settings page - 'optional' // settings section + 'woocommerce_product_tag_slug', + __( 'Product tag base', 'woocommerce' ), + array( $this, 'product_tag_slug_input' ), + 'permalink', + 'optional' ); add_settings_field( - 'woocommerce_product_attribute_slug', // id - __( 'Product attribute base', 'woocommerce' ), // setting title - array( $this, 'product_attribute_slug_input' ), // display callback - 'permalink', // settings page - 'optional' // settings section + 'woocommerce_product_attribute_slug', + __( 'Product attribute base', 'woocommerce' ), + array( $this, 'product_attribute_slug_input' ), + 'permalink', + 'optional' ); $this->permalinks = wc_get_permalink_structure(); @@ -99,9 +99,9 @@ class WC_Admin_Permalink_Settings { * Show the settings. */ public function settings() { - echo wpautop( __( 'These settings control the permalinks used specifically for products.', 'woocommerce' ) ); + /* translators: %s: Home URL */ + echo wp_kses_post( wpautop( sprintf( __( 'If you like, you may enter custom structures for your product URLs here. For example, using shop would make your product links like %sshop/sample-product/. This setting affects product URLs only, not things such as product categories.', 'woocommerce' ), esc_url( home_url( '/' ) ) ) ) ); - // Get shop page $shop_page_id = wc_get_page_id( 'shop' ); $base_slug = urldecode( ( $shop_page_id > 0 && get_post( $shop_page_id ) ) ? get_page_uri( $shop_page_id ) : _x( 'shop', 'default-slug', 'woocommerce' ) ); $product_base = _x( 'product', 'default-slug', 'woocommerce' ); @@ -115,28 +115,29 @@ class WC_Admin_Permalink_Settings { - + - + - + - + +