settings_init();
$self->settings_save();
}
/**
* Init our settings.
*/
public function settings_init() {
add_settings_section( 'storeengine-permalink', __( 'StoreEngine Product permalinks', 'storeengine' ), [ $this, 'settings' ], 'permalink' );
add_settings_field(
'storeengine_product_category_slug',
__( 'Product category base', 'storeengine' ),
[ $this, 'product_category_slug_input' ],
'permalink',
'optional'
);
add_settings_field(
'storeengine_product_tag_slug',
__( 'Product tag base', 'storeengine' ),
[ $this, 'product_tag_slug_input' ],
'permalink',
'optional'
);
$this->permalinks = Helper::get_permalink_structure();
}
public function product_category_slug_input() {
?>
shop would make your product links like %sshop/sample-product/. This setting affects product URLs only, not things such as product categories.', 'storeengine' ), esc_url( home_url( '/' ) ) ) ) );
$shop_page_id = (int) Helper::get_settings( 'shop_page' );
$base_slug = urldecode( ( $shop_page_id > 0 && get_post( $shop_page_id ) ) ? get_page_uri( $shop_page_id ) : _x( 'shop', 'default-slug', 'storeengine' ) );
$product_base = _x( 'product', 'default-slug', 'storeengine' );
$structures = array(
0 => '',
1 => '/' . trailingslashit( $base_slug ),
2 => '/' . trailingslashit( $base_slug ) . trailingslashit( '%product_category%' ),
);
?>
/?product=sample-product //sample-product/ |
|
//sample-product/ |
|