Skip Navigation

[Résolu] Next and Previous custom links for CPT is not working as expected

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.

Marqué : 

This topic contains 24 réponses, has 2 voix.

Last updated by Cesar Il y a 2 années et 4 mois.

Assigned support staff: Shane.

Auteur
Publications
#1235476
Captura de pantalla 2019-04-25 a las 10.50.50.png

I am trying to replicate the solution posted here:
https://toolset.com/forums/topic/display-wpv-post-next-link-and-wpv-post-previous-link-as-raw-html-link/

I use the same code on function.php and have tried to use the Custom code snippets from settings but got an error (see screenshoot)

The code is now on function.php and seams to work but it is not. In the following example we expect to get 12 post but when using the post navigation shortcode we can only navigate through 4 post

Link to a page where the issue can be seen:
Archive with 12 post
hidden link
First post, navigate with the arrows to see that only 4 post are listed
hidden link

Does the code still run or is there something wrong with my site?
*EDIT*
I've try to use the native function from the theme in a single.php and got the same error for CPT so the problem come from my CPT. I have 3 CPT and all have the same issue.
Post nav on regular Blog post work as expected:
hidden link

Thanks

#1235710
#1235761

I hope you can access now, sorry for the issue. Thanks

#1235862

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2019-04-25 at 3.35.20 PM.png

Hi Cesar,

I was able to access the site now but not the login page.

See screenshot as this is the error i'm getting.

Thanks,
Shane

#1235997

Shame on me, I'm so sorry for that. I totally forgot to disable all the security tweeks. Please forgive me, you should be able to access now.
Sorry!
Have a great day

#1236312

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Cesar,

Not sure I understand the pagination issue fully because from what I can tell it works fine.

It navigates to the next post in that CPT.

Is it that you're saying that the navigation isn't following the same order as how the posts are listed here?
hidden link

Please clarify for me.

Thanks,
Shane

#1236355

The issue you describe does also matter to me but the one that really concern me is the one described in the previous message.

I understand is not easy to understand, neither it is to explain it 😉

To replicate follow this steps:
===========================

1. Go to the main page for the CPT
hidden link

2. Count the number of post (AKA 12 post for this CPT)

3. Go to the first post

4. Use the arrow > to navigate

5. Start counting how many post you can navigate until there navigation stop working

6. Compare the number of post and the total count of the posts you were able to navigate

From my side I can only navigate through 4 post but there are 12 post in total. This is the error that really matter to me

=================
Of course I would love to be able to navigate by post name and not by ID and also would love to be able to respect the search query when navigating from post. But I will ask for help in another ticket for those topics. Right now the only thing that I need is to be able to navigate from Post-1 to Post-12

Thanks again for your help!

#1236401

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Cesar,

I understand the issue now.

It seems to be an issue with the custom code itself not getting all the information.

Might I recommend using these shortcodes.
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-554769
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-next-link

They should be able to provide you with the previous and next post link.

Please let me know if this can work for you.
Thanks,
Shane

#1236966

Thanks for your answer,

Your solution will not solve my needs as I wont be able to customize the format of the output.

Anyway I already tried this way and the problem persist. There is no way I can see every post when using the post navigation.
You can see it by yourself:
hidden link

#1237117

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Cesar,

I tried creating my own custom pagination with the default wordpress pagination functions and still the same issue.

Can i make changes to this site as I see fit ? I want to try changing the theme to see if this has any effect. You should get all the 12 posts through the pagination.

Looking forward to hearing from you on this.
Thanks,
Shane

#1237176

Please, let me prepare a clone so that you can do whatever you may need. I will let you know asap the new url
Thanks

#1237421

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Cesar,

Thanks i've enabled the private fields for this .

#1237675
#1237965

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Cesar,

Currently testing your code on my localhost to see what the result is if it will actually go through all the posts that I have.

Will update when I can.

Thanks,
Shane

#1238688

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Cesar,

In my testing of your custom shortcode it works perfectly fine.

I tried taking a look at the test site again but it seems to be down.

Could you check on this for me and let me know so that I can continue checking on the issue there since it works fine on my end.

Thanks,
Shane