Astra_SureCart::customize_surecart_title_area( string $title, string $post_type, bool $singular = false )
Method to customize SureCart single title area.
Description
Parameters
- $title
-
(string) (Required) Title Area label.
- $post_type
-
(string) (Required) Current post type.
- $singular
-
(bool) (Optional) Whether singular or plural.
Default value: false
Return
(string) Returns customized label for title area.
Source
File: inc/compatibility/surecart/class-astra-surecart.php
public function customize_surecart_title_area( $title, $post_type, $singular = false ) {
$surecart_titles = array(
'sc_product' => array(
'single' => __( 'Product', 'astra' ),
'archive' => __( 'Products', 'astra' ),
),
'sc_collection' => array(
'single' => __( 'Collection', 'astra' ),
'archive' => __( 'Collections', 'astra' ),
),
'sc_upsell' => array(
'single' => __( 'Upsell', 'astra' ),
'archive' => __( 'Upsells', 'astra' ),
),
);
$type = $singular ? 'single' : 'archive';
// Check for SureCart's post types and customize the title.
if ( isset( $surecart_titles[ $post_type ][ $type ] ) ) {
$title_area_suffix = ' ' . __( 'Title Area', 'astra' );
return $surecart_titles[ $post_type ][ $type ] . $title_area_suffix;
}
return $title;
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 4.7.3 | Introduced. |