NooTheme Premium WordPress Theme › Forums › JobMonster › Hide expired offers from the Archive page
- This topic has 13 replies, 2 voices, and was last updated 6 hours, 15 minutes ago by aureludo.
-
AuthorPosts
-
1 month, 1 week ago #1221948
Hi Jackie
I would like to hide expired job offers older than 1 year from the archive page and searches. But still leave them in the database for natural referencing ๐
Where can I find this query to do this? and how to modify it?
Thanks in advance
Ludovic
1 month, 1 week ago #1221954Hi.
Thank you for contacting us.
To hide the expired job offer, please go to Customize/ Job & Company/ Job listing and scroll down, you will see the option "Shoe Expired Job". Please turn off that option. https://prnt.sc/WW4YhxwmS66i
Regards.
1 month, 1 week ago #1221956Hi Jackie,
Thanks !
I just tested on my child theme to put on OFF but it didn't change anything, I thought there was a change of a php file, so I tested with the main theme but it still displays the expired offers in the archives ๐
can you look on the test server and tell me which files to modify on my production server?
Regards
1 month, 1 week ago #1221957This reply has been marked as private.2 weeks, 1 day ago #1222005Hi.
I have checked your site with the expired job:
https://ev.dev-toursncrea.fr/?post_type=noo_job&p=14373
The expired job: "Moniteur dโatelier / Technicien cycle Paris" doesn't appear in the job search and archived job page when you turn off the "show expired" job in the customize. https://prnt.sc/C8PYDmVP0oRd
Please recheck it.
Regards.
2 weeks, 1 day ago #1222009Hi Jackie,
Happy New Year ๐
Thanks !
I just understood I had not put a date in "Offer expiration date" but in "Ad end date".
Do you have an SQL query to take the "Ad end date" and put it in "Offer expiration date" or tell me the fields so I can do it on my side?
Is there a way to still display expired jobs on another page or with a parameter in the url for example? because I often search for an expired offer to renew it from /city/paris for example where "paris" is the department of my search
how is the redirection then managed if the offer has expired? 404 error or redirection to the offer archive page?
Thank you
1 week, 1 day ago #1222026Sorry, do you want to copy the closing value to the expired field on the job? https://prnt.sc/jawLN2NpnImx
I'm unsure, but I'll help you check the source code.
To display expired jobs on another page, a lot of source code needs to be changed. We can help you display the expired jobs on another page with the URL parameter, but for the search page, it also needs to change the query source code with the URL parameter.
Regards.
1 week, 1 day ago #1222028Hi Jackie,
Thanks !
Yes that's right, I'm going to find a query or do it manually because otherwise it gives me 404 errors, I have to manage the redirects manually otherwise I'm going to lose my SEO with the 404 errors
for expired offers I don't need the search engine because it's just for me.
Or maybe an even simpler idea comes to me to avoid 404 errors ๐ How to hide closed offers in the archive page? like that the offers disappear for visitors since they are closed but still accessible for Google and no 404 error ๐
It must be simpler, just the query of the archive page and search engine to modify right?
Regards
3 days, 18 hours ago #1222042Hi.
We use cron action to check the job expiry and set the job status to expired. When the post status changes to expired, it will change the post URL /?post_type=noo_job&p=jobid.
So if you want to keep the job URL, you need to disable the noo_job_check_expired_jobs() action on the file: wp-content/themes/noo-jobmonster/framework/job/job-expired.php line 43.
The expired job will not change the status to expired.
After that, you can still see the expired job on the archived page. To hide the expired job, please go to this file:
wp-content/themes/noo-jobmonster/layouts/job/loop/loop.php
under line 64, you need to add the source code below to ignore the expired job:
$closing_date = get_post_meta( $post->ID, '_closing', true ); $closing_date = empty( $closing_date ) || is_numeric( $closing_date ) ? $closing_date : strtotime( $closing_date ); $is_expired = ( 'expired' == get_post_status( $post->ID ) ) || ( ! empty( $closing_date ) && $closing_date <= strtotime('-1 day',time()) ); if ($is_expired) continue;
This code use to check the closing date on the job.
Please recheck it.
Regards.
3 days, 15 hours ago #1222048Hi Jackie,
I just added the 5 lines of code in my child theme it doesn't seem to work.
I added it again in the parent theme it doesn't seem to work either ๐
I placed this code just after this line
$data_marker = 'data-marker="'.esc_attr(json_encode(jm_get_marker_job_data($post->ID))).'"';
Thanks in advance
2 days, 19 hours ago #1222055Hi.
Please check this expired job: https://ev.dev-toursncrea.fr/offre-emploi/commercial-clubs-et-collectivites-nord/
You can't see the job on the Archive page, but the URL is fine.
Please recheck it.
Regards.
2 days, 16 hours ago #1222058Hi Jackie,
Thanks it works ๐
I fixed the access to the Archive page (slug error) but there is still the navigation as well as the number of job offers found how to modify so that it is displayed correctly?
https://ev.dev-toursncrea.fr/ville/auvergne-rhone-alpes/
If you can give me all the modified code in order to put on my server in production
Thanks in advance
Have a nice day
6 hours, 54 minutes ago #1222072Hi.
I have removed the source code on the loop file and add the new source code on this file
wp-content/themes/noo-jobmonster/framework/job/job-query.php
below line 50 to hide the expired job on the Archive:
// hide expried job on the Archive if ( is_post_type_archive( 'noo_job' )){ $query->set('meta_query', array( array( 'key' => '_closing', 'value' => current_time('timestamp'), 'compare' => '>=', 'type' => 'NUMERIC', ), )); }
Please recheck it.
Regards.
6 hours, 15 minutes ago #1222076Hi,
I just looked but it shows me all the closed offers on my side ๐
Regards
-
AuthorPosts
You must be logged in and have valid license to reply to this topic.