get_gallery_image_ids();
if ( ! $attachment_ids ) {
$classes[] = 'kt-product-no-thumbnail-images';
}
}
return $classes;
}
add_filter( 'post_class', 'single_product_post_class' );
// Add Product Nav above title
function ascend_woo_product_navigation() {
$ascend = ascend_get_options();
if ( isset( $ascend['product_single_nav'] ) && $ascend['product_single_nav'] == '1' ) {
echo '
';
}
}
add_action( 'woocommerce_after_single_product_summary', 'ascend_woo_product_navigation', 12 );
function ascend_woo_product_title_cat() {
global $post;
$ascend = ascend_get_options();
if ( isset( $ascend['product_cat_above_title'] ) && $ascend['product_cat_above_title'] == '1' ) {
echo '';
$main_term = ascend_get_primary_term( $post->ID, 'product_cat' );
if ( $main_term ) {
echo esc_html( $main_term->name );
}
echo '
';
}
}
add_action( 'woocommerce_single_product_summary', 'ascend_woo_product_title_cat', 4 );
if ( isset( $ascend['product_post_title_inpost'] ) && $ascend['product_post_title_inpost'] == 0 ) {
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
}
/**
* Function to filter how many related posts show.
*
* @param array $args current args.
*/
function ascend_product_related_products_limit( $args ) {
$ascend = ascend_get_options();
if ( ! empty( $ascend['related_item_column'] ) ) {
$args['columns'] = $ascend['related_item_column'];
}
$args['posts_per_page'] = 8;
return $args;
}
add_filter( 'woocommerce_output_related_products_args', 'ascend_product_related_products_limit' );
// Display product tabs?
add_action( 'wp_head', 'ascend_woo_tab_check' );
function ascend_woo_tab_check() {
$ascend = ascend_get_options();
if ( isset( $ascend['product_tabs'] ) && $ascend['product_tabs'] == 'none' ) {
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
} elseif ( isset( $ascend['product_tabs'] ) && $ascend['product_tabs'] == 'list' ) {
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
add_action( 'woocommerce_after_single_product_summary', 'ascend_woo_output_product_tabs_list', 10 );
}
}
function ascend_woo_output_product_tabs_list() {
$tabs = apply_filters( 'woocommerce_product_tabs', array() );
if ( ! empty( $tabs ) ) : ?>
';
echo '';
}
add_action( 'woocommerce_before_single_product_summary', 'ascend_woocommerce_image_wrap_end', 50 );
function ascend_woocommerce_image_wrap_end() {
echo '
';
echo '';
}
add_action( 'woocommerce_single_product_summary', 'ascend_woocommerce_summary_wrap_end', 100 );
function ascend_woocommerce_summary_wrap_end() {
echo '
';
echo '';
}
add_filter( 'woocommerce_reset_variations_link', 'ascend_woocommerce_reset_variations_text' );
function ascend_woocommerce_reset_variations_text( $html ) {
$ascend = ascend_get_options();
if ( ! empty( $ascend['wc_clear_placeholder_text'] ) ) {
$cleartext = $ascend['wc_clear_placeholder_text'];
} else {
$cleartext = __( 'Clear selection', 'ascend' );
}
$html = '' . esc_html( $cleartext ) . '';
return $html;
}
}
}
add_action( 'after_setup_theme', 'ascend_single_woocommerce_support' );