Skip Navigation

[Resolved] The paginations are not appearing

This support ticket is created 5 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 11 replies, has 2 voices.

Last updated by deepS 5 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#1316957

Wow, you are simply great. I have achieved everything I needed and you did things so patiently and neatly that I must appreciate.

I have tried adding pagination to the results and added some code (including CSS) in Loop editor of 'Weekly Jobs' view: hidden link
But the paginations are not appearing. Can you help me find out where the wrong is? Thanks.

#1316969

Hello,

I have checked it in your website, please open the URL you mentioned above:
hidden link

in section "Pagination and Sliders Settings", you are using option "Display 10 items per page", there aren't 10 more child "Job Post Details" posts in each "Job" post, so the pagination won't display.

You can change above option to "Display 1 items per page", then test it again in front-end, you should be able to see the pagination works in front-end.

#1316973

Well, this looks a bit odd. Please tell me will it work if I use the pagination using option "Display 10 items per page" in "Expired Job posts- within 7 days" view?

#1316995

Same as above, it should be able to work when there are 10 more "Job" post found.

But you are using nested view:
- Parent post view "Expired Job posts- within 7 days"
- Child post view "Weekly Jobs"

Each view's pagination can manage it's own result.

Here is the document about Views pagination:
https://toolset.com/documentation/user-guides/views-pagination/

#1318417

Sorry for the delayed reply. I have gone through the documentation provided by you.

As I was sorting for different options to solve the issue, I couldn't help myself to get into the situation. I don't know how, but do you have any solution to this like the way you solved my serial number issue?

#1318741

Yes, it is possible with custom PHP codes, for example you can setup a post view: "Job Post Details Expired within 7 days":
- Query "Job Post Details" posts
- Display the pagination shortcode
Use Views filter hook wpv_filter_query to trigger a custom PHP function:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

in this PHP function to these:
- Get "Job" post IDs which are Expired within 7 days"
- Use above "Job" post IDs to get related "Job Post Details" post's IDs
- Use those "Job Post Details" post's IDs to add a filter into view "Job Post Details Expired within 7 days"

More help
https://developer.wordpress.org/reference/classes/wp_query/#post-page-parameters
post__in (array) – use post ids. Specify posts to retrieve

If you need more assistance for it, please provide a test site with credentials and FTP access, also point out the problem page URL and view URL, and where I can edit your PHP codes, I can setup a demo for you.

#1319885

Thanks for the details, I have done below modifications in your website:
1) Create three posts views:

a) Parent view - expired-job-posts-within-7-days
hidden link
- Query Jobs posts
- Filter by:
Select items with field:
Last Date of Application is a number between PAST_DAY(7), PAST_DAY(1)
- Enable option "Disable the wrapping DIV around the View"
- in view's loop, display below child view with shortcodes:

...
<wpv-loop>[wpv-item index=1][wpv-view name="child-view-expired-job-posts-within-7-days"][wpv-item index=other],[wpv-view name="child-view-expired-job-posts-within-7-days"]</wpv-loop>
...

We use it to output "Job Post Details" post's IDs, for example: 123, 456, 789

b) Child view - expired-job-posts-within-7-days:
hidden link
- Query "Job Post Details" posts
- Filter by:
Select items from the Job Post Details group that are a related to the current post in the loop.
- Enable option "Disable the wrapping DIV around the View"
- in view's loop, display "Job Post Details" post's ID shortcode with shortcodes:

...
<wpv-loop>[wpv-item index=1][wpv-post-id][wpv-item index=other],[wpv-post-id]</wpv-loop>
...

c) List Job Post Details posts
hidden link
- Query Jobs posts
- Filter by:
Include only posts with IDs set by the View shortcode attribute "ids" eg. [wpv-view name="view-name" ids="1"]
- in view's loop, display "Job Post Details" post's information + pagination shortcodes:

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<ol class="wpv-loop js-wpv-loop">
		<wpv-loop>
			<li>[wpv-post-body view_template="loop-item-in-list-job-post-details-posts"]</li>
		</wpv-loop>
	</ol>
	<!-- wpv-loop-end -->

<ul class="pagination">
	<li class="page-item">[wpv-pager-prev-page][wpml-string context="wpv-views"]Previous[/wpml-string][/wpv-pager-prev-page]</li>
	<li class="page-item">[wpv-pager-next-page][wpml-string context="wpv-views"]Next[/wpml-string][/wpv-pager-next-page]</li>
</ul>
...

2) Create another page "Weekly Jobs 2":
hidden link
Display the 3rd post view with "ids" attribute:

[wpv-view name="list-job-post-details-posts" ids='[wpv-view name="parent-view-expired-job-posts-within-7-days"]']

See the result here:
hidden link

Please check if it is what you want, thanks

#1320175

You are awesome. You met most of my demands. This one is a bit critical than what I was expecting. I couldn't understand why have you created these two views separately "Parent view - expired-job-posts-within-7-days" and "Child view - expired-job-posts-within-7-days". I would appreciate it if you explain to me briefly.

Well, everything is ok with your work except for one thing. That the first job post details (repeatable field group) of each Job Post ID is not showing up. To see the difference please compare these two pages:

hidden link (the new one) showing a total of 14 jobs

hidden link (the previous one) showing a total of 16 jobs

#1320687

The "Parent view - expired-job-posts-within-7-days" and "Child view - expired-job-posts-within-7-days" are for outputs "Job Post Details" post's IDs whose parent "Job" posts are expired within 7 days, then pass those IDs to view "List Job Post Details posts", see details I mentioned above:
https://toolset.com/forums/topic/the-paginations-are-not-appearing/#post-1318741

I have checked both URLs you mentioned above, both of them output 35 results.

Where do you want to display the "Job Post ID"? please elaborate the question with more details, for example, you can edit the content template "Parent Job post information":
hidden link
Display the Job Post ID, like this:

Job Post ID: [wpv-post-id]

For the question:
hidden link (the previous one) showing a total of 16 jobs

Please open above URL:
just below "10. Technician – Cardiology", you should be able to see there is a pagination settings, it hides some Job Post Details posts, so the count in URL is accurate:
hidden link

#1321759

For the time being, I have stopped pagination for the views that display the result on 'Weekly Jobs' (the old one) and 'Weekly Jobs 2' (the new one) and both of them displays the same query results.

Now,
Q 1: you can see in weekly jobs 2 we were trying to order the queries as per the field 'Last date of application', but it's not reflecting the things on the page hidden link (whereas Weekly Jobs page is showing the right data hidden link)

Q 2: If you see the number of jobs post (RFG) on both these pages 'Weekly jobs' and 'Weekly Jobs 2' are different whereas they are supposed to show the same data.

Please have a look.

#1321769

Q) you can see in weekly jobs 2 we were trying to order the queries as per the field 'Last date of application'

Same problem, there isn't custom field 'Last date of application' within repeatable field group "Job Post Details", so you can not order the result by field 'Last date of application' directly, instead you can order by the "post__in" parameter, and it needs custom codes, I have added below PHP codes into your theme file "functions.php":

add_filter( 'wpv_filter_query', function($query_args, $view_settings, $view_id){
    if($view_id == 15646){ // view "List Job Post Details posts" ID
        $query_args['orderby'] = 'post__in';
    }
    return $query_args;
}, 999, 3);

More help:
https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters

Q2) If you see the number of jobs post (RFG) on both these pages 'Weekly jobs' and 'Weekly Jobs 2' are different whereas they are supposed to show the same data.
It might be a cache problem, since the workaround I provided are using nested view to provide the attribute value.

And as you can see: the source problem is in custom field 'Last date of application', in your case, you can consider these:
1) move this date field 'Last date of application' to repeatable field group "Job Post Details",
2) edit each item of "Job Post Details" setup value in custom field 'Last date of application

then you can create a post view:
- query the "Job Post Details" posts
- and filter the by custom field 'Last date of application' directly

And it will be able to make the Views result stable

#1321811

Hi, thankfully my problem has been resolved. I fixed the issue of not showing all the jobs. I changed the value of index to 0 instead of 1 in Child view - expired-job-posts-within-7-days

<wpv-loop>[wpv-item index=0][wpv-post-id][wpv-item index=other],[wpv-post-id]</wpv-loop>