Hi,
Thank you for sharing the admin access.
To get the total number of available jobs, on each state's page ( e.g. hidden link ), you can follow these steps:
1. Please create a duplicate of your view "Location wise Jobs actual" ( ID: 19495 )
In this view make sure that the pagination is set to "No pagination" and in the "Loop Editor" section, it should include code to return the number of vacancies:
[wpv-layout-start][wpv-items-found]<!-- wpv-loop-start --><wpv-loop>[sum-rfg],</wpv-loop><!-- wpv-loop-end -->[/wpv-items-found][wpv-no-items-found]0[/wpv-no-items-found][wpv-layout-end]
2. Next, create a duplicate of your view "states-view-grandparent" ( ID: 17991 ).
In this new view, you can remove all custom CSS and JS added in their respective tabs and make sure that the "Loop Editor" only includes code to return the nested view's output:
[wpv-layout-start][wpv-items-found]<!-- wpv-loop-start --><wpv-loop>[wpv-view name="location-wise-jobs-actual-copy" ids="[wpv-view name='places-belongs-state']"],</wpv-loop><!-- wpv-loop-end -->[/wpv-items-found][wpv-no-items-found]0[/wpv-no-items-found][wpv-layout-end]
Note: Please make sure to replace "location-wise-jobs-actual-copy" with the actual slug of the view, created in step 1.
Also, check the option "Disable the wrapping DIV around the View" just below the "Loop Editor".
3. After that, you can update the custom shortcode that I shared earlier slightly so that it includes the attribute "ids" for the target state:
add_shortcode( 'show_count_of_field_values', 'show_count_of_field_values_func');
function show_count_of_field_values_func() {
$args = array(
'id' => 1234,
'ids' => ''
);
$view_output = render_view( $args );
$view_output_arr = explode(',', $view_output);
if(!empty($view_output_arr)) {
$count = 0;
foreach ($view_output_arr as $item) {
$count = $count + $item;
}
return $count;
}
}
Note: Please replace "1234" with the actual ID of the view created in step 2.
4. You'll be able to use the final shortcode like this:
[show_count_of_field_values ids="16142"]
This will give you a total of vacancies from the "Assam" state ( ID: 16142 ) and you can replace 16142 in the shortcode to get the count for different states.
I hope this helps and please let me know if you need any further assistance around this.
regards and Happy New Year,
Waqar