Skip Navigation

[Resolved] Link to next and previous child posts on child page

This thread is resolved. Here is a description of the problem and solution.

Problem:
Link to next and previous child posts on child page

Solution:
To display the prev and next pagination link based on some custom field value and calculation is not supported. It needs custom programming.

You can find proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/link-to-next-and-previous-child-posts-on-child-page/#post-1074800

Relevant Documentation:
https://toolset.com/documentation/user-guides/views-pagination/

This support ticket is created 6 years, 5 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 6 years, 5 months ago.

Assisted by: Minesh.

Author
Posts
#1074297

Ok. So this was super helpful and I have this working now where it will display the other trainings in the module. Thank you!

Now I'd like to take it one step further...

So the trainings now have a custom number field named "Position in Module" and since now a training can only be connected to 1 module, I'd like to use this value to navigate to sibling trainings in the module.
(or if there's an easier way to navigate siblings open to that as well)

So if the current training I'm viewing is in position 2, I'd like to add a back button that would link to the training in position 1 and a next button that links to the training in position 3.

I imagine this will require 2 views, one for each button with a value passed to it like above.

But how do I create the query that basically says:

For back link:
Find the related training post ID in the parent module where "Position in Module" field value = ("Position in Module" value of Current training being viewed - 1)

And for next link obviously it's +1.

Guessing I need some sort of custom function to generate this value?

#1074800

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

For back link:
Find the related training post ID in the parent module where "Position in Module" field value = ("Position in Module" value of Current training being viewed - 1)
And for next link obviously it's +1.
==> Well - it certainly need a custom code to do the calculation deduct 1 for previous link and add 1 for next link from the position module custom field value. There is no native way to do it.

View's pagination is attached to specific view to which the content is belongs to so you can not find out from middle which post should be shown.

You can find all relevant information for view's pagination with the following Doc:
=> https://toolset.com/documentation/user-guides/views-pagination/

If your requirement is not covered with above Doc that means it needs custom programming to calculate your previous and next link which is beyond the scope of our support policy. If you need custom programming for your project, please feel free to contact our certified partners:
=> https://toolset.com/contractors/