';
echo '';
echo '';
}
/**
* Adds an opening div "oceanwp-toolbar" around top elements.
*
* @since 1.1.1
*/
public static function add_shop_loop_div() {
echo '
';
}
/**
* Register off canvas filter sidebar.
*
* @since 1.5.0
*/
public static function register_off_canvas_sidebar() {
register_sidebar( array (
'name' => esc_html__( 'Off-Canvas Filters', 'oceanwp' ),
'description' => esc_html__( 'Widgets in this area are used in the off canvas sidebar. To enable the Off Canvas filter, go to the WooCommerce > Archives section of the customizer and enable the Display Filter Button option.', 'oceanwp' ),
'id' => 'owp_off_canvas_sidebar',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
) );
}
/**
* Get Off Canvas Sidebar.
*
* @since 1.5.0
*/
public static function get_off_canvas_sidebar() {
// Return if is not in shop page
if ( ! oceanwp_is_woo_shop()
&& ! oceanwp_is_woo_tax() ) {
return;
}
if ( function_exists( 'wc_get_template' ) ) {
wc_get_template( 'owp-off-canvas-sidebar.php' );
}
}
/**
* Add off canvas filter button.
*
* @since 1.5.0
*/
public static function off_canvas_filter_button() {
// Return if is not in shop page
if ( ! oceanwp_is_woo_shop()
&& ! oceanwp_is_woo_tax() ) {
return;
}
// Get filter text
$text = get_theme_mod( 'ocean_woo_off_canvas_filter_text' );
$text = oceanwp_tm_translation( 'ocean_woo_off_canvas_filter_text', $text );
$text = $text ? $text: esc_html__( 'Filter', 'oceanwp' );
$output = ''. esc_html( $text ) .'';
echo apply_filters( 'oceanwp_off_canvas_filter_button_output', $output );
}
/**
* Add grid/list buttons.
*
* @since 1.1.1
*/
public static function grid_list_buttons() {
// Return if is not in shop page
if ( ! oceanwp_is_woo_shop()
&& ! oceanwp_is_woo_tax() ) {
return;
}
// Titles
$grid_view = esc_html__( 'Grid view', 'oceanwp' );
$list_view = esc_html__( 'List view', 'oceanwp' );
// Active class
if ( 'list' == get_theme_mod( 'ocean_woo_catalog_view', 'grid' ) ) {
$list = 'active ';
$grid = '';
} else {
$grid = 'active ';
$list = '';
}
$output = sprintf( '', esc_html( $grid_view ), esc_attr( $grid ), esc_html( $list_view ), esc_attr( $list ) );
echo wp_kses_post( apply_filters( 'oceanwp_grid_list_buttons_output', $output ) );
}
/**
* Closes the opening div "oceanwp-toolbar" around top elements.
*
* @since 1.1.1
*/
public static function close_shop_loop_div() {
echo '
';
}
/**
* Add result count.
*
* @since 1.1.1
*/
public static function result_count() {
// Return if is not in shop page
if ( ! oceanwp_is_woo_shop()
&& ! is_product_category()
&& ! is_product_tag()
&& ! ocean_is_wc_attribute() ) {
return;
}
get_template_part( 'woocommerce/result-count' );
}
/**
* Returns correct posts per page for the shop
*
* @since 1.0.0
*/
public static function loop_shop_per_page() {
if ( get_theme_mod( 'ocean_woo_shop_result_count', true ) ) {
$posts_per_page = ( isset( $_GET['products-per-page'] ) ) ? sanitize_text_field( wp_unslash( $_GET['products-per-page'] ) ) : get_theme_mod( 'ocean_woo_shop_posts_per_page', '12' );
if ( $posts_per_page == 'all' ) {
$posts_per_page = wp_count_posts( 'product' )->publish;
}
} else {
$posts_per_page = get_theme_mod( 'ocean_woo_shop_posts_per_page' );
$posts_per_page = $posts_per_page ? $posts_per_page : '12';
}
return $posts_per_page;
}
/**
* Change products per row for the main shop.
*
* @since 1.0.0
*/
public static function loop_shop_columns() {
$columns = get_theme_mod( 'ocean_woocommerce_shop_columns', '3' );
$columns = $columns ? $columns : '3';
return $columns;
}
/**
* Change products per row for upsells.
*
* @since 1.0.0
*/
public static function upsell_display() {
// Get count
$count = get_theme_mod( 'ocean_woocommerce_upsells_count', '3' );
$count = $count ? $count : '3';
// Get columns
$columns = get_theme_mod( 'ocean_woocommerce_upsells_columns', '3' );
$columns = $columns ? $columns : '3';
// Alter upsell display
woocommerce_upsell_display( $count, $columns );
}
/**
* Change products per row for crossells.
*
* @since 1.0.0
*/
public static function cross_sell_display() {
// Get count
$count = get_theme_mod( 'ocean_woocommerce_cross_sells_count', '2' );
$count = $count ? $count : '2';
// Get columns
$columns = get_theme_mod( 'ocean_woocommerce_cross_sells_columns', '2' );
$columns = $columns ? $columns : '2';
// Alter cross-sell display
woocommerce_cross_sell_display( $count, $columns );
}
/**
* Alter the related product arguments.
*
* @since 1.0.0
*/
public static function related_product_args() {
// Get global vars
global $product, $orderby, $related;
// Get posts per page
$posts_per_page = get_theme_mod( 'ocean_woocommerce_related_count', '3' );
$posts_per_page = $posts_per_page ? $posts_per_page : '3';
// Get columns
$columns = get_theme_mod( 'ocean_woocommerce_related_columns', '3' );
$columns = $columns ? $columns : '3';
// Return array
return array(
'posts_per_page' => $posts_per_page,
'columns' => $columns,
);
}
/**
* Adds an opening div "product-inner" around product entries.
*
* @since 1.0.0
*/
public static function add_shop_loop_item_inner_div() {
echo '
';
}
/**
* Adds an out of stock tag to the products.
*
* @since 1.0.0
*/
public static function add_out_of_stock_badge() {
if ( function_exists( 'oceanwp_woo_product_instock' ) && ! oceanwp_woo_product_instock() ) {
$label = esc_html__( 'Out of Stock', 'oceanwp' ); ?>
';
}
/**
* Quick view button.
*
* @since 1.5.0
*/
public static function quick_view_button() {
global $product;
$button = '' . oceanwp_theme_strings( 'owp-string-woo-quick-view-text', false, 'oceanwp' ) . '';
echo apply_filters( 'ocean_woo_quick_view_button_html', $button ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Quick view ajax.
*
* @since 1.5.0
*/
public static function product_quick_view_ajax() {
if ( ! isset( $_REQUEST['product_id'] ) ) {
die();
}
$product_id = intval( $_REQUEST['product_id'] );
// wp_query for the product.
wp( 'p=' . $product_id . '&post_type=product' );
ob_start();
get_template_part( 'woocommerce/quick-view-content' );
echo ob_get_clean();
die();
}
/**
* Quick view template.
*
* @since 1.5.0
*/
public static function quick_view_template() {
get_template_part( 'woocommerce/quick-view' );
}
/**
* Quick view image.
*
* @since 1.5.0
*/
public static function quick_view_image() {
get_template_part( 'woocommerce/quick-view-image' );
}
/**
* Clear floats after single product summary.
*
* @since 1.0.0
*/
public static function clear_summary_floats() {
echo '';
}
/**
* Single product content.
*
* @since 1.1.9
*/
public static function single_product_content() {
if ( function_exists( 'wc_get_template' ) ) {
wc_get_template( 'owp-single-product.php' );
}
}
/**
* Add product navigation.
*
* @since 1.5.0
*/
public static function product_next_prev_nav() {
global $post;
$next_post = get_next_post( true, '', 'product_cat' );
$prev_post = get_previous_post( true, '', 'product_cat' );
// Next text
$next_text = esc_html__( 'Previous Product', 'oceanwp' );
$next_text = apply_filters( 'ocean_woo_nav_next_text', $next_text );
// Prev text
$prev_text = esc_html__( 'Next Product', 'oceanwp' );
$prev_text = apply_filters( 'ocean_woo_nav_prev_text', $prev_text ); ?>
';
}
/**
* Add wrap to the account navigation.
*
* @since 1.0.0
*/
public static function oceanwp_after_account_navigation() {
echo '
';
}
/**
* Adds container wrap for the thumbnail and title of the categories products.
*
* @since 1.1.1.1
*/
public static function add_container_wrap_category() {
echo '
';
}
/**
* Adds a container div before the thumbnail for the categories products.
*
* @since 1.1.1.1
*/
public static function add_div_before_category_thumbnail( $category ) {
echo '
';
}
/**
* Adds a container div before the thumbnail for the categories products.
*
* @since 1.1.1.1
*/
public static function add_div_before_category_title( $category ) {
echo '
';
}
}
/**
* Close a container div before the thumbnail for the categories products.
*
* @since 1.1.1.1
*/
public static function close_div_after_category_title() {
echo '
';
}
/**
* Close container wrap for the thumbnail and title of the categories products.
*
* @since 1.1.1.1
*/
public static function close_container_wrap_category() {
echo '
';
}
/**
* Before my account login.
*
* @since 1.0.0
*/
public static function oceanwp_login_wrap_before() {
echo '
';
}
/**
* After my account login.
*
* @since 1.0.0
*/
public static function oceanwp_login_wrap_after() {
echo '
';
}
/**
* Display the categories featured images.
*
* @since 1.0.0
*/
public static function woocommerce_category_image() {
if ( is_product_category() ) {
global $wp_query;
$cat = $wp_query->get_queried_object();
$thumbnail_id = get_term_meta( $cat->term_id, 'thumbnail_id', true );
$image = wp_get_attachment_url( $thumbnail_id );
if ( $image ) {
echo '
';
// Return menu items
return $items;
}
/**
* Adds cart icon to menu
*
* @since 1.0.0
*/
public static function menu_cart_icon( $items, $args ) {
// Return items if is in the Elementor edit mode, to avoid error
if ( OCEANWP_ELEMENTOR_ACTIVE
&& \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
return $items;
}
// Only used for the main menu
if ( 'main_menu' != $args->theme_location ) {
return $items;
}
// Get style
$style = oceanwp_menu_cart_style();
$header_style = oceanwp_header_style();
// Return items if no style
if ( ! $style ) {
return $items;
}
// Add cart link to menu items
if ( 'full_screen' == $header_style ) {
$items .= '