If there is a company in my company page on my site, but the job has already expired or they already found a person for their job, how can I make it so the company is hidden?
Because I can imagine a situation where there are a bunch of companies listed in my companies section of my site, but when a user clicks on it, it will just say “no results” because the job they posted already expired.
How can I hide the companies (in the companies section) that don’t have any active jobs available? And only show the ones which have an active job listing?
Sorry, there’s no such option in the current version, when the last listing of a company is expired or hidden the company profile is not hidden or deleted. We can try to provide a temporary code snippet for this, but it may require further customizations.
Thanks for your suggestion, we’ll consider adding this feature.
To show companies with current job posts, if I understand you correctly, please try these PHP snippets (replace “one, two, three” with the field names you want to keep in sync with the vendor fields):
Ok, I just tried it but I didn’t notice any effect. I put in your code and activated it but there was no change.
I have one test company with no jobs but the company still shows up in the companies page.
Also, I don’t really understand this part “replace “one, two, three” with the field names you want to keep in sync with the vendor fields” so I just kept it the same.
Please try to update any of the company listings, this snippet is triggered only when a listing is published or unpublished, just activating the snippet will not show/hide companies automatically.
This didn’t seem to work either. After using this snippet, I created a fake company call “test company” but when I click publish, nothing happens.
And when I created a test job, “test company” didn’t show up in the company section of the new job.
It seems like this snippet just prevents me from being able to create a new company in the wordpress dashboard.
When I turned off this snippet then I was able to publish the company. But that leaves me with the same issue of companies showing up with no available jobs.
If you create a vendor in the admin panel or the non-vendor user tries to become a vendor by adding a listing or with the direct vendor registration, then this code snippet checks if this vendor has at least one listing. If there is any published listing that belongs to this vendor, then the vendor gets a status Draft and becomes not visible on the frontend for other users
If the vendor’s listing becomes invisible to other users (for example, it passes the expiration date, which is set in the Expiration Date attribute for the listing) and the vendor does not have other published listings, then the vendor gets a status Draft and becomes not visible on the frontend for other users
If the vendor’s listing becomes visible for other users (for example, you approve some listing to publish), then the vendor gets a status Publish and becomes visible on the frontend for other users.
Does it work for you, or is something missing here?
This code snippet works mostly for vendors. So you as admin can only create vendors which will get draft status as they do not have any listings. If the vendor will add some listing and you approve it (if you have this restriction), then the vendor becomes published. It works in this way in general. Unfortunately, there is no simple code snippet to make it more flexible, it requires advanced customization. But it is possible to use this code snippet for further customization. If you are not familiar with the code customization then please consider hiring someone for custom work https://fvrr.co/32e7LvY
“If the vendor will add some listing and you approve it (if you have this restriction), then the vendor becomes published. It works in this way in general.”
But when a user wants to create an account and add a listing, they will have to create the company first. With this code implemented will the new users even be able to create a company?
Ok, in that case, thank you for creating the code but I can’t use it now. As my site is new, I have to upload all the companies and jobs myself. So for me to continue to do that, I can’t use your code (because it stops me from being able to publish companies).
Maybe in the future if I get to the point where all the new jobs and companies are created by the users themselves (and not me) then maybe this code will be useful.