Hi,
I am making one job website. I have achieved with the support of your technical team to generate a view on the front end from related posts. Naturally, I have put some conditions for displaying the results like showing expired job lists (created through RFG) when the last date of the application expires.
Well, when the data meets the condition it displays on the front end, but there are certain occasions when that section remain vacant due to non-fulfillment of the conditions. Here I want to show the message like "No job expired recently".
Even I achieved it but it's repeating for all the RFGs. See the screenshot_5.
I have used following code in views:
[wpv-conditional if="( $(wpcf-last-date-of-application).item(@job-post-details.parent) lt 'TODAY()' )"]
<h4>[types field="post-name"][/types]</h4>
<p>No. of Vacancies: [types field="no-of-vacancies"][/types]</p>
[/wpv-conditional]
[wpv-conditional if="( $(wpcf-last-date-of-application).item(@job-post-details.parent) gte 'TODAY()' )"]
No job expired recently.
[/wpv-conditional]
I want this message to be shown once in the page where the view generates blank data. Please help.
There's nothing built-in to Views that will display different information based on the results of other instances of the View on the same page. If the View results are shown together, you could probably use CSS to hide all but the first element. Add a unique classname to a span tag around the message:
[wpv-conditional if="( $(wpcf-last-date-of-application).item(@job-post-details.parent) gte 'TODAY()' )"]
<span class="no-results-found-your-view-slug">No job expired recently.</span>
[/wpv-conditional]
Then add CSS to the View's Loop editor CSS panel:
.no-results-found-your-view-slug {
display:none;
}
.no-results-found-your-view-slug:first-of-type {
display:block;
}
You should change "your-view-slug" to match the slug of this View.
Hi Christian,
As always you give superb support to resolve my issues, I am very thankful. In fact, the view issues with the 'Job posts' on the 'Companies' (related) page were resolved by you. Here also your tricks worked fine except those instances where there are different 'Last dates of application'. You can see the page here: hidden link
I am attaching the Screenshot_6 for your better understanding.
See my objective is to show the information of the expired job post on different past dates or showing 'No Job expired' only once instead of the vacant space on the page when there is no data. Well, I took the approach that I think suitable (but alternative ways are welcome if it shows the result I want). Hope you understand my point.
Here I am generating results for the page using views: 'Expired Job Vacancy' and 'Expired Job in Company' and content 'Template for Companies'
If you wish I can give you access to my wp backend.
Unfortunately I don't have a simple solution. Each View acts independently of other Views on the page, so there's no way for one View to easily know if another View on the page had results or not. It might be possible to achieve this with custom code, using the Views API. We offer the API get_view_query_results, which allows you to inspect the results of any View using PHP: https://toolset.com/documentation/programmer-reference/views-api/#get_view_query_results
If you need assistance with this API, I can help troubleshoot any PHP code that touches the API.
Yah I understood your point. But the problem is I don't know how to fix the issue with API function. I'd be obliged to get your support. Thanks.
But the problem is I don't know how to fix the issue with API function.
Okay I can help you troubleshoot problems in your own custom code. That does not mean I can write this code for you. You are asking for a feature that is not offered by Toolset, and supporters are not able to create new features for you. Please review our support policy: https://toolset.com/toolset-support-policy/
I can help you troubleshoot your code if it uses the APIs. If you need someone to write custom code for you, you can connect with independent developers in our contractors portal here: https://toolset.com/contractors
Or for smaller projects, you may be able to find assistance here: https://codeable.io/developers/toolset/
Please keep the ticket open. I am working on it.
Great, I'll stand by for your feedback.
My issue is resolved now. Thank you!