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 March 20, 2019 05:30
Jobhunt - Job Single V1 Mobile Style Change
if ( ! function_exists( 'jh_child_single_job_listing_related_jobs_rearrange_mobile' ) ) {
function jh_child_single_job_listing_related_jobs_rearrange_mobile() {
if( function_exists( 'jobhunt_get_wpjm_single_style' ) && ( jobhunt_get_wpjm_single_style() == 'v1' ) ) {
add_action( 'single_job_listing_sidebar', 'jobhunt_single_job_listing_related_jobs', 40 );
}
}
}
add_action( 'init', 'jh_child_single_job_listing_related_jobs_rearrange_mobile' );
@yousufansa
yousufansa / functions.php
Created February 8, 2019 07:41
Jobhunt - Add Posted Jobs Count In Admin User Table
if ( ! function_exists( 'jh_child_add_user_table_column' ) ) {
function jh_child_add_user_table_column( $column ) {
if ( post_type_exists( 'job_listing' ) ) {
$column['jobs'] = esc_html__( 'Jobs', 'jobhunt-child' );
}
return $column;
}
}
add_filter( 'manage_users_columns', 'jh_child_add_user_table_column' );
@yousufansa
yousufansa / functions.php
Created February 8, 2019 07:53
Jobhunt - Add Author Name On Company Admin Table
if ( ! function_exists( 'jh_child_columns_head_only_companys' ) ) {
function jh_child_columns_head_only_companys($defaults) {
$defaults['author'] = esc_html__( 'Author', 'jobhunt-child' );
return $defaults;
}
}
add_filter('manage_edit-company_columns', 'jh_child_columns_head_only_companys', 10);
if ( ! function_exists( 'jh_child_columns_content_only_companys' ) ) {
function jh_child_columns_content_only_companys($column_name, $post_ID) {
@yousufansa
yousufansa / functions.php
Created February 12, 2019 09:49
Bethlehem - Change Team Members Order
if( ! function_exists( 'bethlehem_child_pre_get_posts' ) ) {
function bethlehem_child_pre_get_posts( $query ) {
if ( $query->is_post_type_archive( 'team-member' ) || $query->is_tax( get_object_taxonomies( 'team-member' ) ) ) {
if( ! isset( $query->query_vars['orderby'] ) ) {
$query->set( 'orderby', apply_filters( 'team_members_orderby', 'date' ) );
}
if( ! isset( $query->query_vars['order'] ) ) {
$query->set( 'order', apply_filters( 'team_members_order', 'DESC' ) );
}
@yousufansa
yousufansa / functions.php
Last active February 27, 2019 07:09
Jobhunt - Create Custom Fields Based on Job Package
if ( ! function_exists( 'jobhunt_child_custom_submit_job_form_package_id_field' ) ) {
function jobhunt_child_custom_submit_job_form_package_id_field () {
$job_id = ! empty( $_REQUEST['job_id'] ) ? absint( $_REQUEST['job_id'] ) : 0;
if( ! empty( $job_id ) && $job_id > 0 && ! empty( get_post_meta( $job_id, '_package_id', true ) ) ) {
$package_id = get_post_meta( $job_id, '_package_id', true );
} else {
$package_id = WP_Job_Manager_WCPL_Submit_Job_Form::get_package_id();
}
?><input type="hidden" name="_package_id" value="<?php echo esc_attr( $package_id ); ?>" /><?php
}
@yousufansa
yousufansa / functions.php
Created March 12, 2019 09:19
Jobhunt - Change Header Register Form URL
if ( !function_exists('jh_child_header_register_page_custom_url') ) {
function jh_child_header_register_page_custom_url( $page_url ) {
return 'your_url_here';
}
}
add_filter('jobhunt_header_register_page_url', 'jh_child_header_register_page_custom_url');
@yousufansa
yousufansa / functions.php
Created March 12, 2019 09:20
Jobhunt - Change Header Register Form URL
if ( !function_exists('jh_child_header_login_page_custom_url') ) {
function jh_child_header_login_page_custom_url( $page_url ) {
return 'your_url_here';
}
}
add_filter('jobhunt_header_login_page_url', 'jh_child_header_login_page_custom_url');
@yousufansa
yousufansa / functions.php
Last active April 20, 2020 10:06
Jobhunt - Add Post A Job Custom Form Fields ( Example )
if ( ! function_exists( 'jobhunt_child_custom_submit_job_form_fields' ) ) {
function jobhunt_child_custom_submit_job_form_fields ($fields) {
$fields['job']['job_salary'] = array(/* field name without prefix _ (underscore) - you can find the field name by inspecting that field in add new job on WP Admin Panel */
'label' => esc_html__( 'Job Salary', 'jobhunt' ),/* Replace "Job Salary" with Your Field Title. */
'type' => 'text',
'placeholder' => esc_html__( 'job salary ex: $100', 'jobhunt' )',/* Replace "Job Salary" with Your Field placeholder. */
'priority' => 10,
'required' => false
);
return $fields;
@yousufansa
yousufansa / functions.php
Created April 15, 2019 05:42
WC - Add SKU In WooCommerce Product Search
/**
* Join posts and postmeta tables
*
* @param string $join
* @param WP_Query $query
* @return string
*/
if( ! function_exists( 'wc_custom_product_search_join' ) ) {
function wc_custom_product_search_join( $join, $query ) {
if ( ! $query->is_main_query() || is_admin() || ! is_search() || ! is_woocommerce() ) {
@yousufansa
yousufansa / functions.php
Created May 14, 2019 07:10
Electro - Theme Option Site Logo Integration With Wordpress Custom Logo
if ( !function_exists( 'electro_child_set_custom_logo' ) ) {
function electro_child_set_custom_logo() {
if( function_exists( 'is_redux_activated' ) && is_redux_activated() ) {
global $electro_options;
if ( ! empty( $electro_options['site_header_logo']['id'] ) ) {
$custom_logo_id = $electro_options['site_header_logo']['id'];
set_theme_mod( 'custom_logo', $custom_logo_id );
} else {
set_theme_mod( 'custom_logo', '' );
}