NooTheme Premium WordPress Theme › Forums › JobMonster › Related Jobs
This topic is: resolved
- This topic has 8 replies, 2 voices, and was last updated 3 years, 5 months ago by sofer770.
Viewing 9 posts - 1 through 9 (of 9 total)
-
AuthorPosts
-
3 years, 6 months ago #1208793
I would like to display related jobs by job-tag, not by job-category. Is it possible?
3 years, 6 months ago #1208816If you want do it, please install and switch your site to use Jobmonster child theme, then add custom PHP code in Jobmonster child theme's file functions.php
add_filter('noo_related_jobs_query_args', function($query_args){ $job_tags = get_the_terms(get_the_ID(), 'job_tag'); if(!is_wp_error($job_tags) && !empty($job_tags)){ $job_tag_slugs = array(); foreach ($job_tags as $job_tag) { $job_tag_slugs[] = $job_tag->slug; } $query_args['tax_query'] = array( 'taxonomy' => 'job_tag', 'field' => 'slug', 'terms' => $job_tag_slugs, ); } return $query_args; });
Best regards.
3 years, 6 months ago #1208839This reply has been marked as private.3 years, 6 months ago #1208859Dear, Please kindly send for me admin account and your site URL via private reply, i will check details to help you.
Best regards.
3 years, 5 months ago #1208894This reply has been marked as private.3 years, 5 months ago #1208926I not see you add custom code on your site ? Please check again.
3 years, 5 months ago #1208975Now there is.
3 years, 5 months ago #1208999Dear, I check and change custom code to
add_filter('noo_related_jobs_query_args',function($query_args){ $job_tags = get_the_terms(get_the_ID(), 'job_tag'); if(!is_wp_error($job_tags) && !empty($job_tags)){ $query_args['tax_query'] = array('relation' => 'AND'); $job_tag_slugs = array(); foreach ($job_tags as $job_tag) { $job_tag_slugs[] = $job_tag->slug; } $query_args['tax_query'][] = array( 'taxonomy' => 'job_tag', 'field' => 'slug', 'terms' => $job_tag_slugs, ); } return $query_args; });
Now, i see it's working, please check your site again.
Best regards.
3 years, 5 months ago #1209030All right! Thank you very much!
-
AuthorPosts
Viewing 9 posts - 1 through 9 (of 9 total)
You must be logged in and have valid license to reply to this topic.