Skip Navigation

[Resolved] next and previous with two custom post

This support ticket is created 3 years, 9 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: Africa/Casablanca (GMT+01:00)

This topic contains 25 replies, has 3 voices.

Last updated by kayser 3 years, 9 months ago.

Assisted by: Jamal.

Author
Posts
#1963603

Hello
Three days ago Waqar found me this solution.
https://toolset.com/forums/topic/next-and-previous/#post-1953307

I thought I could adapt this solution, but I couldn't because in my case it's a relationship between two custom posts. It is not the current author, but the artist (custom post) who has several books.
hidden link
How to adapt it to this relationship
Thank you
guyk

#1963627

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

If you want to use the post relationship, then you will require to use the custom shortcode as described at top of the following ticket.
=> https://toolset.com/forums/topic/how-to-show-next-previous-child-post/

I would like to know first where exactly you want to display prev/next link, on single post page of post type books? If yes, how we can know that what books belongs to what parent?

#1963649

Hi Minesh
Yes on the page of a single post book(custom post),
this artist(custom post) has 18 books
hidden link

hidden link
and it's on this page when you consult a book that you have to navigate through these books before moving on to the next artist
Guyk

#1963671

Minesh
Supporter

Languages: English (English )

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

Ok - its big hard to filter the prev/next link on single post of the book.

What if we create a page and on that page we will add a view that should display the related posts and you should configure that view to display your single book post information - will that help?

#1963683

Thank you Minesh
But I already have a solution to display the books of the same artist as a list, on the same page, and I will come back to that.
Guy

#1963693

Minesh
Supporter

Languages: English (English )

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

Ok because, we need to pass the parent ID.

And on single book post, lets say you clicked on 3rd related book post and redirect to single book post, how we can know what will be the 1st and 2nd post. Its bit difficult thing. That is why I shared the idea to create a page and to that page we should add a view that should display 1 book post at a time and we will add pagination prev/next.

#1963701

OK, this seems to be a good solution, can you help me work this out?

#1963797

Minesh
Supporter

Languages: English (English )

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

Can you please share admin access details so I can setup a demo for you.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1963843

Minesh
Supporter

Languages: English (English )

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

Just to confirm with you again that - I will add a page, to this newly created page I'll add a view that will display 1 result per page at a time and it will only display the related posts (books) belongs to the current parent post.

For instance, on this page: hidden link
When you click on any of the related post, it will redirect to new page called "show-related-posts" and on that page I will add a view that shows related posts belongs to "nelly-avila" - 1 post at a time.

#1963873

It does indeed sound like a good idea.
With navigation arrows for books by the same artist?
And maybe
With a switch to the next or previous artist when one's books are finished?

#1963907

Minesh
Supporter

Languages: English (English )

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

I've created the follow view: hidden link
- Where I've added only post link for now within the "Loop Editor" section, you can adjust the output as required by you and set this view to display only 1 result per page.

Then, I've created the following page and added the above view to this page:
- hidden link

And then, I've modified your following view that is added to your parent post page:
- hidden link

I've added the "Fields and Text" block and constructed the title with link as given under:

<h4 class="tb-heading"><a href="/show-related-posts/?wpv-relationship-filter=[wpv-post-id item='$current_page']&&wpv_paged=[wpv-loop-index]&wpv_view_count=5459">[wpv-post-title]</a></h4>

Now, if you click on any of the child post on the following post:
- hidden link

It will redirect you to the page/show-related-posts/ and it will also respect what item you clicked.

#1963911

Minesh was already working like that.
this is not my request.
I just wanted navigation arrows in the same artist's books
Guy

#1963945

Minesh
Supporter

Languages: English (English )

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

I crafted that solution because I asked you here:
- https://toolset.com/forums/topic/next-and-previous-with-two-custom-post/#post-1963843

And then you told me that yes, it's a good idea:
- https://toolset.com/forums/topic/next-and-previous-with-two-custom-post/#post-1963873

You mean - on this page: hidden link

You want to display 1 post page page and i should add pagination links?

#1963955

Excuse me minesh but I use the help of ggogle translation ...
But it's dabns this page that I want the pagination and navigation between the books of the same artist.
hidden link...

#1963963

Minesh
Supporter

Languages: English (English )

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

See now: hidden link

I've set the view to display only 1 record per page and you will find the "Next" button to move to the next post or same artist.

You can format the output and next button as required with your view:
- hidden link