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
Created November 17, 2020 05:25
MAS Videos - Store custom user meta values during user registration ( First Name & Last Name )
if ( ! function_exists( 'masvideos_save_custom_user_meta' ) ) {
function masvideos_save_custom_user_meta( $user_id ) {
$nonce_value = isset( $_POST['_wpnonce'] ) ? $_POST['_wpnonce'] : '';
$nonce_value = isset( $_POST['masvideos-register-nonce'] ) ? $_POST['masvideos-register-nonce'] : $nonce_value;
if ( ! empty( $_POST['register'] ) && wp_verify_nonce( $nonce_value, 'masvideos-register' ) ) {
if ( ! empty( $_POST['first_name'] ) ) {
update_user_meta( $user_id, 'first_name', trim( $_POST['first_name'] ) );
}
if ( ! empty( $_POST['last_name'] ) ) {
@yousufansa
yousufansa / functions.php
Last active February 4, 2021 18:36
Jobhunt - Add Password Confirm Field on WooCommerce Register Form
if( ! function_exists( 'jh_child_woocommerce_register_form_confirm_password' ) ) {
function jh_child_woocommerce_register_form_confirm_password() {
if ( 'no' === get_option( 'woocommerce_registration_generate_password' ) ) {
?>
<p class="form-row form-row-wide">
<label for="reg_confirm_password"><?php _e( 'Confirm Password ', 'jobhunt' ); ?>&nbsp;<span class="required">*</span></label>
<input type="password" class="woocommerce-Input woocommerce-Input--text input-text" name="confirm_password" id="reg_confirm_password" autocomplete="new-password" />
</p>
<div class="clear"></div>
<?php
@yousufansa
yousufansa / functions.php
Created November 6, 2020 16:15
Front - Customer Story - Fix Single Customer Story Sticky Content
if( ! function_exists( 'front_single_customer_story_sticky_end' ) ) {
function front_single_customer_story_sticky_end() {
?><div id="stickyBlockEndPoint"></div><?php
}
}
add_action( 'front_customer_story_single_post', 'front_single_customer_story_sticky_end', 50 );
@yousufansa
yousufansa / functions.php
Created November 6, 2020 05:10
Jobhunt - Resume Contact Visibility Issue Fix
if ( ! function_exists( 'jobhunt_candidate_socail_network' ) ) {
function jobhunt_candidate_socail_network() {
global $post;
if( resume_manager_user_can_view_contact_details( $post->ID ) && ( ! empty( get_the_candidate_twitter_page() || get_the_candidate_facebook_page() || get_the_candidate_googleplus_page() || get_the_candidate_linkedin_page() || get_the_candidate_instagram_page() || get_the_candidate_youtube_page() || get_the_candidate_behance_page() || get_the_candidate_pinterest_page() || get_the_candidate_github_page() ) ) ) :
echo '<div class="social-network-pages">';
do_action( 'get_jobhunt_candidate_socail_network' );
echo '</div>';
endif;
}
}
@yousufansa
yousufansa / functions.php
Created October 30, 2020 05:46
Cartzilla - Remove Dokan Pro Header My Account Dropdown Menu Items in Marketplace Header
if ( ! function_exists( 'cz_child_modify_my_account_dokan_dropdown_menu_items' ) ) {
function cz_child_modify_my_account_dokan_dropdown_menu_items( $menu_items ) {
if( isset( $menu_items['followers'] ) ) {
unset( $menu_items['followers'] );
}
if( isset( $menu_items['coupons'] ) ) {
unset( $menu_items['coupons'] );
}
@yousufansa
yousufansa / functions.php
Created October 29, 2020 06:49
Cartzilla - Disable Dokan Header My Account Dropdown Menu
add_filter( 'cartzilla_enable_my_account_dokan_dropdown_menu_items', '__return_false' );
@yousufansa
yousufansa / functions.php
Created October 27, 2020 16:24
Jobhunt - Disable User Role dropdown From Register Form & Make Employer as User Role
if ( ! function_exists( 'jh_child_register_form_user_role_as_employer' ) ) {
function jh_child_register_form_user_role_as_employer() {
if( function_exists( 'jobhunt_is_wp_job_manager_activated' ) && jobhunt_is_wp_job_manager_activated() ) {
?><input type="hidden" name="jobhunt_user_role" value="employer"/><?php
}
}
}
add_action( 'jobhunt_registration_form_fields_after', 'jh_child_register_form_user_role_as_employer', 99 );
add_filter( 'jobhunt_register_user_role_enabled', '__return_false' );
@yousufansa
yousufansa / functions.php
Created October 27, 2020 16:10
Jobhunt - Change Post A Job Form Custom Taxonomy Fields as Required
if ( ! function_exists( 'jh_child_submit_job_form_change_taxonomy_fields_required' ) ) {
function jh_child_submit_job_form_change_taxonomy_fields_required( $fields ) {
if( isset( $fields['job']['job_category'] ) ) {
$fields['job']['job_category']['required'] = true;
}
if( isset( $fields['job']['job_listing_salary'] ) ) {
$fields['job']['job_listing_salary']['required'] = true;
}
@yousufansa
yousufansa / functions.php
Created October 27, 2020 15:54
Vodi - Allow Scripts in Single Movie & Video Banners
if ( ! function_exists( 'vodi_template_single_movie_sidebar_banner' ) ) {
function vodi_template_single_movie_sidebar_banner() {
$banner_image_id = get_post_meta( get_the_ID(), '_vodi_movie_banner_image', true );
$banner_link = get_post_meta( get_the_ID(), '_vodi_movie_banner_link', true );
$banner_content = apply_filters( 'vodi_movie_banner_content', '' );
if( ! empty( $banner_image_id ) || ! empty( $banner_content ) ) {
?><div class="single-movie__sidebar--banner-image"><?php
if( ! empty( $banner_image_id ) ) {
if( ! empty( $banner_link ) ) {
@yousufansa
yousufansa / functions.php
Created October 27, 2020 14:51
Cartzilla - Display Product Category Description on Product Category page before products loop
if( ! function_exists( 'cz_child_display_product_category_description' ) ) {
function cz_child_display_product_category_description() {
if ( is_product_category() && ! empty( term_description() ) ) {
?><div class="mb-4"><?php echo term_description(); ?></div><?php
}
}
}
add_action( 'woocommerce_before_shop_loop', 'cz_child_display_product_category_description', 16 );