Skip to content

Instantly share code, notes, and snippets.

@farookibrahim
farookibrahim / functions.php
Created July 17, 2020 15:37
Vodi - Add Play Trailer button in Movie v1
if ( ! function_exists( 'vodi_template_single_movie_v1_play_trailer_button' ) ) {
function vodi_template_single_movie_v1_play_trailer_button() {
global $movie;
$movie_id = $movie->get_ID();
$trailer_button_text = get_post_meta( $movie_id, '_vodi_movie_play_trailer_text', true );
$trailer_button_link = get_post_meta( $movie_id, '_vodi_movie_play_trailer_link', true );
if ( ! empty( $trailer_button_text ) && ! empty( $trailer_button_link ) ) : ?>
<div class="single-movie__actions">
<a href="<?php echo esc_url( $trailer_button_link ); ?>" class="movie-actions--play-trailers" tabindex="0" target="_blank">
@farookibrahim
farookibrahim / functions.php
Created July 17, 2020 13:48
Vodi - TV Shows Section Aside Header Block update column
if( ! function_exists( 'vi_child_tv_show_section_aside_header_args' ) ) {
function vi_child_tv_show_section_aside_header_args( $args ) {
$args['shortcode_atts']['columns'] = 7;
return $args;
}
}
add_filter( 'vodi_tv_show_section_aside_header_args', 'vi_child_tv_show_section_aside_header_args', 10 );
@farookibrahim
farookibrahim / functions.php
Created July 15, 2020 09:40
Vodi - Cast(Stars) section in Movie v1
if ( ! function_exists( 'vodi_toggle_single_movie_v6_hooks' ) ) {
function vodi_toggle_single_movie_v6_hooks() {
if ( vodi_get_single_movie_style() == 'v1' ) {
add_action( 'masvideos_after_single_movie_summary', 'vodi_template_single_movie_casts', 30 );
}
}
}
add_action( 'masvideos_before_single_movie', 'vodi_toggle_single_movie_v6_hooks', 20 );
@farookibrahim
farookibrahim / functions.php
Created July 7, 2020 04:46
WooCommerce - Custom "Add to cart" text
function woocommerce_custom_product_add_to_cart_text( $text, $product ) {
$product_type = $product->product_type;
switch ( $product_type ) {
case 'external':
return __( 'Buy product', 'woocommerce' );
break;
@farookibrahim
farookibrahim / functions.php
Created July 6, 2020 10:49
Vodi - TV Shows Rating Filter force 1st page after filter
if( ! function_exists( 'vodi_child_tv_shows_rating_filter_link' ) ) {
function vodi_child_tv_shows_rating_filter_link( $link ) {
$pattern = '/page\\/[0-9]+\\//i';
$link = preg_replace( $pattern, '', $link );
return $link;
}
}
add_filter( 'masvideos_tv_shows_rating_filter_link', 'vodi_child_tv_shows_rating_filter_link', 20 );
@farookibrahim
farookibrahim / functions.php
Last active July 6, 2020 10:49
Vodi - Movies Rating Filter force 1st page after filter
if( ! function_exists( 'vodi_child_movies_rating_filter_link' ) ) {
function vodi_child_movies_rating_filter_link( $link ) {
$pattern = '/page\\/[0-9]+\\//i';
$link = preg_replace( $pattern, '', $link );
return $link;
}
}
add_filter( 'masvideos_movies_rating_filter_link', 'vodi_child_movies_rating_filter_link', 20 );
@farookibrahim
farookibrahim / functions.php
Created July 3, 2020 15:08
Front - Increase Collapse List Limit
if( ! function_exists( 'front_child_collapse_rangecontrol_max_limit_increase' ) ) {
function front_child_collapse_rangecontrol_max_limit_increase() {
$custom_script = '
var addFilter = wp.hooks.addFilter;
addFilter("frontgb.list-group.listlimit.edit.inspector.max.limit", "front-child/list-group-listlimit-edit-inspector-max-limit", frontChildCollapseRangeControlMaxLimit);
function frontChildCollapseRangeControlMaxLimit(limit) {
return 48;
}
';
@farookibrahim
farookibrahim / functions.php
Created July 3, 2020 14:28
Vodi - Display Full Date in Movie Meta instead of Year
if ( ! function_exists( 'masvideos_template_single_movie_release_year' ) ) {
function masvideos_template_single_movie_release_year() {
global $movie;
$relaese_year = '';
$release_date = $movie->get_movie_release_date();
if( ! empty( $release_date ) ) {
$relaese_year = date( 'j F Y', strtotime( $release_date ) );
}
@farookibrahim
farookibrahim / functions.php
Created July 3, 2020 13:43
Vodi - Remove Season Tabs from Single TV Show
if ( ! function_exists( 'vi_child_remove_seasons_tabs_from_single_tv_show' ) ) {
function vi_child_remove_seasons_tabs_from_single_tv_show() {
remove_action( 'masvideos_after_single_tv_show_summary', 'vodi_single_tv_show_seasons_tabs_wrap_open', 9 );
remove_action( 'masvideos_after_single_tv_show_summary', 'masvideos_template_single_tv_show_seasons_tabs', 10 );
remove_action( 'masvideos_after_single_tv_show_summary', 'vodi_single_tv_show_seasons_tabs_wrap_close', 11 );
}
}
add_action( 'init', 'vi_child_remove_seasons_tabs_from_single_tv_show' );
@farookibrahim
farookibrahim / functions.php
Created July 3, 2020 09:50
Vodi - Movie archive page title customize
if( ! function_exists( 'vodi_child_mv_movie_page_title' ) ) {
function vodi_child_mv_movie_page_title( $page_title ) {
if ( is_search() ) {
/* translators: %s: search query */
$page_title = sprintf( __( 'Search results: &ldquo;%s&rdquo;', 'masvideos' ), get_search_query() );
if ( get_query_var( 'paged' ) ) {
/* translators: %s: page number */
$page_title .= sprintf( __( '&nbsp;&ndash; Page %s', 'masvideos' ), get_query_var( 'paged' ) );