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 September 24, 2020 16:27
Front Jobs - Candidate Register Form Shortcode
if ( ! function_exists( 'front_child_candidate_account_job_register_form' ) ) {
function front_child_candidate_account_job_register_form() {
?><form method="post" class="register" <?php do_action( 'front_job_register_form_tag' ); ?> >
<?php do_action( 'front_job_register_form_start' ); ?>
<?php if ( get_option( 'users_can_register' ) ) : ?>
<div class="form-group">
<label class="form-label" for="reg_username"><?php esc_html_e( 'Username', 'front' ); ?>&nbsp;<span class="required">*</span></label>
<input type="text" class="form-control input-text" name="username" id="reg_username" autocomplete="username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( wp_unslash( $_POST['username'] ) ) : ''; ?>" /><?php // @codingStandardsIgnoreLine ?>
@yousufansa
yousufansa / functions.php
Last active October 2, 2020 15:23
Front Jobs - Employer Register Form Shortcode
if ( ! function_exists( 'front_child_employer_account_job_register_form' ) ) {
function front_child_employer_account_job_register_form() {
ob_start();
?><form method="post" class="register" <?php do_action( 'front_job_register_form_tag' ); ?> >
<?php do_action( 'front_job_register_form_start' ); ?>
<?php if ( get_option( 'users_can_register' ) ) : ?>
<div class="form-group">
<label class="form-label" for="reg_username"><?php esc_html_e( 'Username', 'front' ); ?>&nbsp;<span class="required">*</span></label>
@yousufansa
yousufansa / functions.php
Created September 22, 2020 07:46
MAS Videos - Unregister Post Types ( TV Show, TV Show Playlist, Episode, Video, Video Playlist, Person )
if( !function_exists( 'masvideos_child_get_unregister_post_types' ) ) {
function masvideos_child_get_unregister_post_types(){
// Hide the line prevent from remove that post type (currently movie & movies playlist are prevented from remove)
$post_types = [];
// $post_types[] = 'movie'; // Remove Movie Post Type
// $post_types[] = 'movie_playlist'; // Remove Movie Playlist Post Type
$post_types[] = 'tv_show'; // Remove TV Show Post Type
$post_types[] = 'tv_show_playlist'; // Remove TV Show Playlist Post Type
$post_types[] = 'episode'; // Remove Episode Post Type
$post_types[] = 'video'; // Remove Video Post Type
@yousufansa
yousufansa / functions.php
Created September 22, 2020 05:49
MAS WPJMC - Change Company Post Type Admin Menu Label
function mas_wpjmc_custom_admin_menu_label( $args ) {
$args['labels']['menu_name'] = 'Organization';
return $args;
}
add_filter( 'register_post_type_company', 'mas_wpjmc_custom_admin_menu_label', 20 );
@yousufansa
yousufansa / functions.php
Last active November 22, 2020 12:32
Jobhunt - Add Terms Checkbox in Post A Job Page
if ( ! function_exists( 'jh_child_display_terms_field' ) ) {
function jh_child_display_terms_field() {
$field = [];
$field['name'] = 'terms';
$field['label'] = apply_filters( 'jh_child_wpjm_terms_field_label', __( 'Terms & Condition', 'jobhunt-child' ) );
$field['required'] = true;
$field['type'] = 'checkbox';
$field['description'] = apply_filters(
'jh_child_wpjm_terms_field_description',
wp_sprintf( __( 'I Accept <a href=%s target="_blank">Terms & Conditions</a>', 'jobhunt-child' ), '#' ) // Repace # with your terms page link
@yousufansa
yousufansa / functions.php
Created September 17, 2020 04:33
Jobhunt - Adjust the Testimonial Excerpt Words Length
if ( ! function_exists( 'jh_child_modify_testimonial_block_excerpt_length' ) ) {
function jh_child_modify_testimonial_block_excerpt_length( $length ) {
$length = 30; // adjust 30 with yours.
return $length;
}
}
add_filter( 'jobhunt_testimonial_block_excerpt_length', 'jh_child_modify_testimonial_block_excerpt_length' );
@yousufansa
yousufansa / functions.php
Created September 15, 2020 14:11
Jobhunt - Display Job Title before Job Description
if ( ! function_exists( 'jh_child_single_job_listing_title' ) ) {
function jh_child_single_job_listing_title() {
?><h3 class="job-listing-single-job__title"><?php wpjm_the_job_title(); ?></h3><?php
}
}
add_action( 'single_job_listing', 'jh_child_single_job_listing_title', 5 );
@yousufansa
yousufansa / functions.php
Created September 15, 2020 13:53
MAS WPJMC - Change the Companies Default Catalog Ordering
if ( ! function_exists( 'mas_companies_default_catalog_ordering_customized_args' ) ) {
function mas_companies_default_catalog_ordering_customized_args( $orderby_value ) {
return 'title'; // available options : title, title-desc, data, data-asc, menu_order, rand
}
}
add_filter( 'mas_companies_default_catalog_orderby', 'mas_companies_default_catalog_ordering_customized_args', 10 );
@yousufansa
yousufansa / company-submitted.php
Created September 15, 2020 13:42
MAS WPJMC - Fix Company Submitted Escaping Issue
<?php
/**
* Message to display when a company has been submitted.
*
* This template can be overridden by copying it to yourtheme/wp-job-manager-company/company-submitted.php.
*
* @author Madras Themes
* @package MAS Companies For WP Job Manager
* @category Template
* @version 1.0.0
@yousufansa
yousufansa / functions.php
Created September 14, 2020 16:05
Cartzilla - Add Media Upload Permission for Seller
function cz_child_allow_seller_uploads_profile_pic() {
if ( ! current_user_can('upload_files') && function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) {
$seller = get_role('seller');
$seller->add_cap('upload_files');
}
}
function cz_child_filter_get_the_user_attachments( $query ) {
$current_user = wp_get_current_user();