Skip to content

Instantly share code, notes, and snippets.

@akther80
akther80 / functions.php
Created October 17, 2023 08:53
MyTravel - Display subcategories in shop page
add_action( 'woocommerce_before_shop_loop', 'mytravel_wc_maybe_show_product_subcategories', 25 );
if ( ! function_exists( 'mytravel_wc_maybe_show_product_subcategories' ) ) {
function mytravel_wc_maybe_show_product_subcategories() {
wc_set_loop_prop( 'loop', 0 );
$product_cat_columns = apply_filters( 'mytravel_product_cat_columns', 3 );
$product_columns = absint( max( 1, wc_get_loop_prop( 'columns', wc_get_default_products_per_row() ) ) );
wc_set_loop_prop( 'columns', $product_cat_columns );
$wc_sub_categories = woocommerce_maybe_show_product_subcategories( '' );
wc_set_loop_prop( 'columns', $product_columns );
@akther80
akther80 / functions.php
Created September 25, 2023 05:05
MyTravel - Move Single Activity & Tour format product sidebar to the top in Mobile view
add_action( 'mytravel_single_activity', 'mytravel_single_product_sidebar', 17 );
add_action( 'mytravel_single_tour', 'mytravel_single_product_sidebar', 21 );
@akther80
akther80 / style.css
Created September 18, 2023 13:02
Geeks - In learning mode, video is not scrolled in desktop
@media(min-width: 992px) {
.tutor-course-single-content-wrapper .geeks-single-quiz-content,
.tutor-course-single-content-wrapper .tutor-lesson-content-area {
margin-bottom: 208px;
}
}
@akther80
akther80 / functions.php
Created September 15, 2023 06:55
MyTravel - DIsplay Room Amenities in Room product format
if ( ! function_exists( 'mytravel_room_amenities_preview_1' ) ) {
/**
* Output room ameniities preview
*/
function mytravel_room_amenities_preview_1() {
if ( ! mytravel_is_acf_activated() ) {
return;
}
$area = mytravel_get_field( 'area' );
@akther80
akther80 / functions.php
Created September 11, 2023 12:27
MyTravel - Change Hotel product ACF hooks to Standard product
add_action( 'woocommerce_before_single_product_summary', 'mytravel_single_hotel_top_badges', 2 );
add_action( 'woocommerce_after_single_product_summary', 'mytravel_single_hotel_amenities', 60 );
add_action( 'woocommerce_after_single_product_summary', 'mytravel_single_hotel_nearest_essentials', 70 );
add_action( 'woocommerce_after_single_product_summary', 'mytravel_single_hotel_landmarks', 90 );
add_action( 'woocommerce_after_single_product_summary', 'mytravel_single_hotel_facts', 90 );
add_action( 'woocommerce_after_single_product_summary', 'mytravel_single_hotel_policy', 100 );
@akther80
akther80 / functions.php
Created September 8, 2023 11:38
MyTravel - Change Add to Cart text as Book
add_filter( 'woocommerce_product_single_add_to_cart_text', 'mas_travels_custom_single_add_to_cart_text' );
function mas_travels_custom_single_add_to_cart_text( $text ) {
$text = esc_html__( 'Book', 'mytravel' );
return $text;
}
@akther80
akther80 / functions.php
Created September 4, 2023 11:20
Geeks - display footer in single lesson page
function page_footer( $disabled ) {
global $post;
$student_register_page_id = (int) tutor_utils()->get_option( 'student_register_page' );
$has_content_access = tutils()->has_enrolled_content_access('lesson');
$instructor_register_page_id = (int) tutor_utils()->get_option( 'instructor_register_page' );
$post_id = isset( $post->ID ) ? $post->ID : false;
$parents = get_post_ancestors( $post_id );
$course_id = ($parents) && ! empty( $parents ) ? $parents[count($parents)-1]: $post_id;
$is_course_public = get_post_meta( $course_id, '_tutor_is_public_course', true );
$_is_preview = get_post_meta( $post_id, '_is_preview', true );
@akther80
akther80 / functions.php
Created September 4, 2023 08:20
MyTravel - Remove format links in WP Admin
add_filter('views_edit-product', 'mytravel_remove_product_format_links' , 20);
function mytravel_remove_product_format_links( $views ) {
if( isset( $views['product_format_links'] ) ) {
unset( $views['product_format_links'] );
}
return $views;
}
@akther80
akther80 / functions.php
Created August 30, 2023 09:25
MyTravel - Display short desc in tour
if ( ! function_exists( 'mytravel_wc_template_loop_tour_display_desc' ) ) {
/**
* Output archive tour display location
*/
function mytravel_wc_template_loop_tour_display_location() {
if ( ! mytravel_is_acf_activated() ) {
return;
}
?>
@akther80
akther80 / style.css
Created July 20, 2023 11:27
Geeks - Tutor SIngle zoom & Google meeting style
@media(max-width: 991px) {
.tutor-lesson-content-area,
.geeks-single-quiz-content{
margin-bottom: 30px;
}
}
.footer-v2 ul.social-menu a i{
font-size: 1.25rem;
}