This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_enqueue_scripts', function() { | |
$language = 'zh-CN'; | |
wp_deregister_script( 'c27-google-maps' ); | |
wp_enqueue_script( 'c27-google-maps', 'https://maps.googleapis.com/maps/api/js?key=' . c27()->get_setting( 'general_google_maps_api_key' ) . '&libraries=places&v=3&language=' . $language, [], null, true ); | |
}, 100 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'woocommerce_created_customer', function( $id ) { | |
wp_new_user_notification( $id, null, 'admin' ); | |
} ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add new fields in the registration form | |
// @link https://www.cloudways.com/blog/add-woocommerce-registration-form-fields/ | |
add_action( 'woocommerce_register_form_start', function() { ?> | |
<p class="form-row form-row-wide"> | |
<label for="reg_billing_phone"><?php _e( 'Phone', 'woocommerce' ); ?></label> | |
<input type="text" class="input-text" name="billing_phone" id="reg_billing_phone" value="<?php esc_attr_e( $_POST['billing_phone'] ); ?>" /> | |
</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_checkout_fields' , function( $fields ) { | |
// List of all checkout fields | |
// @link https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ | |
unset($fields['order']['order_comments']); | |
unset($fields['billing']['billing_company']); | |
return $fields; | |
} ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
$('.single-listing #respond textarea[name="comment"]').prop('required', false).val(' ').hide(); | |
$('.single-listing #respond textarea[name="comment"]').parent().hide(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add a new listing type, and set it's "slug" to "global". | |
- In the Explore page, using Elementor, set this new listing type as the first option in the "Types" tab | |
- In my-listing/includes/integrations/wp-job-manager/wp-job-manager-queries.php around line 235, | |
replace this: | |
``` | |
$args['meta_query'][] = [ | |
'key' => '_case27_listing_type', | |
'value' => $listing_type, | |
'compare' => '=' | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('submit_job_form_validate_fields', function( $isValid, $fields, $values ) { | |
foreach ( $fields['job'] as $key => $field ) { | |
// Example regex validation | |
if ( $field['slug'] == 'phone' && isset( $values['job']['phone'] ) && preg_match( "/(foo)(bar)/", $values['job']['phone'] ) ) { | |
return new \WP_Error( 'validation-error', sprintf( __( '%s isn\'t valid', 'my-listing' ), $field['label'] ) ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'document_title_parts', function( $title ) { | |
if ( get_query_var( 'explore_region' ) && ( $term = get_term_by( 'slug', sanitize_title( get_query_var( 'explore_region' ) ), 'region' ) ) ) { | |
$title['title'] = $term->name; | |
} | |
return $title; | |
}, 99); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'submit_job_form_validate_fields', function( $isValid, $fields, $values ) { | |
$GALLERY_FILE_LIMIT = 5; // Change this to the amount of files you want to allow | |
$values = $values['job']; | |
foreach ( $fields['job'] as $key => $field ) { | |
if ( $field['type'] == 'file' && $field['slug'] == 'job_gallery' && isset( $values[$field['slug']] ) && count( $values[$field['slug']] ) > $GALLERY_FILE_LIMIT ) { | |
return new WP_Error( 'validation-error', sprintf( __( 'You can\'t upload more than %d files in %s field.', 'my-listing' ), $GALLERY_FILE_LIMIT, $field['label'] ) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_product_query', function( $q ) { | |
$tax_query = (array) $q->get( 'product_type' ); | |
$tax_query[] = [ | |
'taxonomy' => 'product_type', | |
'field' => 'slug', | |
'terms' => [ 'job_package', 'job_package_subscription' ], | |
'operator' => 'NOT IN', | |
]; | |
$q->set( 'tax_query', $tax_query ); |