Skip to content

Instantly share code, notes, and snippets.

@akther80
akther80 / functions.php
Last active November 16, 2023 07:04
Vodi - Rearrange Tv Show Tab and Related item position
add_action( 'init', 'rearrange_tv_shows_content');
function rearrange_tv_shows_content() {
remove_action( 'masvideos_after_single_tv_show_summary', 'vodi_template_single_related_tv_shows_carousel', 20 );
remove_action( 'masvideos_after_single_tv_show_summary', 'masvideos_template_single_tv_show_tabs', 30 );
add_action( 'masvideos_after_single_tv_show_summary', 'vodi_template_single_related_tv_shows_carousel', 21 );
add_action( 'masvideos_after_single_tv_show_summary', 'masvideos_template_single_tv_show_tabs', 20 );
}
@akther80
akther80 / functions.php
Created October 27, 2023 13:19
MyTravel - Rename filter dropdown option name
$instance = MAS_Travels::instance();
remove_filter( 'woocommerce_dropdown_variation_attribute_options_html', array( $instance, 'mas_travels_filter_dropdown_option_html' ), 12, 2 );
add_filter( 'woocommerce_dropdown_variation_attribute_options_html','mas_travels_filter_dropdown_option_html',12, 2 );
function mas_travels_filter_dropdown_option_html( $html, $args ) {
global $product;
$product_format = get_product_format() ? get_product_format() : 'standard';
$product_type = $product->get_type();
@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;
}