Skip to content

Instantly share code, notes, and snippets.

View yousufansa's full-sized avatar

Yusuf Ansari yousufansa

View GitHub Profile
@yousufansa
yousufansa / functions.php
Last active October 6, 2020 07:03
Jobhunt - Elementor Pro Custom Header/Footer Container Issue Fix
if ( ! function_exists( 'jh_child_elementor_get_header_after' ) ) {
function jh_child_elementor_get_header_after() {
if( did_action( 'elementor_pro/init' ) && ! is_page() ) {
?>
<div id="content" class="site-content" tabindex="-1">
<div class="container">
<div class="site-content-inner">
<?php
}
}
@yousufansa
yousufansa / functions.php
Created October 5, 2020 13:32
Front App - Change Apps Description Page App Info Title & Icon
if ( ! function_exists( 'front_app_hp_listing_custom_description_tab_title' ) ) {
function front_app_hp_listing_custom_description_tab_title( $title ) {
$title = '<div class="d-md-flex justify-content-md-center align-items-md-center"><span class="d-none d-md-block w-100 line-height-1 max-width-5 mr-3"><i class="font-size-3 fab fa-app-store"></i></span>' . esc_html__( 'App Description', 'front' ) . '</div>';
return $title;
}
}
add_filter( 'front_hp_listing_description_tab_title', 'front_app_hp_listing_custom_description_tab_title' );
@yousufansa
yousufansa / functions.php
Created October 5, 2020 08:32
Cartzilla - Replace Cart with Search in Bottom Handheld Bar
if( ! function_exists( 'cartzilla_handheld_toolbar' ) ) {
function cartzilla_handheld_toolbar() {
?>
<div class="cz-handheld-toolbar">
<div class="collapse border-bottom" id="searchBox">
<div class="card pt-2 pb-4 border-0 rounded-0">
<div class="container">
<?php if ( cartzilla_is_woocommerce_activated() ) : ?>
<?php the_widget( 'WC_Widget_Product_Search', 'title=' ); ?>
<?php else : ?>
@yousufansa
yousufansa / functions.php
Created October 5, 2020 06:38
Cartzilla - Globally Disable Visibility Sensor ( Lazy Load Effect )
if ( ! function_exists( 'cartzilla_enqueue_script_globally_disable_visbilty_sensor' ) ) {
function cartzilla_enqueue_script_globally_disable_visbilty_sensor() {
$custom_script = '
var addFilter = wp.hooks.addFilter;
addFilter("cartzillagb.globally.disable.visibility.sensor", "cartzilla-child/globally.disable.visibility.sensor", cartzillaGoballyDisableVisibilitySensor);
function cartzillaGoballyDisableVisibilitySensor(enabled) {
return true;
}';
@yousufansa
yousufansa / functions.php
Last active October 5, 2020 15:36
Vodi - Display Movie Genre and Movie Tag Term Description in Term Archive Page
if ( ! function_exists( 'vodi_child_display_term_description' ) ) {
function vodi_child_display_term_description() {
if( is_tax() ) {
$tax_obj = get_queried_object();
if( is_tax( 'movie_genre' ) || is_tax( 'movie_tag' ) || taxonomy_is_movie_attribute( $tax_obj->taxonomy ) ) {
$term_description = term_description();
if( ! empty( $term_description ) ) {
echo '<div class="term-description">' . $term_description . '</div>';
}
}
@yousufansa
yousufansa / functions.php
Created October 2, 2020 11:55
Cartzilla - Remove All Error Message Form Single Product Page
if ( ! function_exists( 'cz_child_remove_woocommerce_error_notice' ) ) {
function cz_child_remove_woocommerce_error_notice( $types ) {
if ( is_product() && ( $key = array_search('error', $types) ) !== false) {
unset( $types[$key] );
}
return $types;
}
}
add_filter( 'woocommerce_notice_types', 'cz_child_remove_woocommerce_error_notice', 10 );
@yousufansa
yousufansa / functions.php
Created October 2, 2020 10:41
Electro - Add Accessories Export & Import Support in WC CSV
if( ! function_exists( 'electro_child_add_accessories_export_support' ) ) {
function electro_child_add_accessories_export_support( $meta_value, $meta, $product, $row ) {
if( isset( $meta->key ) && ( $meta->key === '_accessory_ids' ) ) {
$meta_value = implode( ',', $meta_value );
}
return $meta_value;
}
}
@yousufansa
yousufansa / functions.php
Created October 1, 2020 12:09
MAS WPJMC - Enable Select2 Scripts & Styles in Company Dashboard & Submit Form
if ( ! function_exists( 'mas_wpjmc_enhanced_select_enabled' ) ) {
function mas_wpjmc_enhanced_select_enabled( $enabled ) {
if ( has_wpjm_shortcode( null, [ 'mas_submit_company_form', 'mas_company_dashboard' ] ) ) {
$enabled = true;
}
return $enabled;
}
}
add_filter( 'job_manager_enhanced_select_enabled' , 'mas_wpjmc_enhanced_select_enabled' );
@yousufansa
yousufansa / functions.php
Created October 1, 2020 11:23
MAS WPJMC - Fetch & Display Company Logo by Job ID
if ( ! function_exists( 'mas_wpjmc_get_the_job_listing_company' ) ) {
function mas_wpjmc_get_the_job_listing_company( $post = null ) {
if( ! is_object( $post ) ) {
$post = get_post( $post );
}
if ( post_type_exists( 'company' ) || get_post_type( $post->ID ) == 'job_listings' ) {
$company_id = get_post_meta( $post->ID, '_company_id', true );
if( ! empty( $company_id ) ) {
$company = get_post( $company_id );
@yousufansa
yousufansa / functions.php
Created September 28, 2020 11:56
Bookworm - Display Header v1 Topbar Cart on Mobile
if ( ! function_exists( 'bw_child_site_header_icons_wc_cart_args' ) ) {
function bw_child_site_header_icons_wc_cart_args( $links ) {
if ( isset( $links['my_cart'] ) ) {
$links['my_cart']['item_class'] = 'd-block';
}
return $links;
}
}