Skip Navigation

[Gelöst] Infinite Scrolling is not working. wp-pagenavi is not working on custom post typ

This support ticket is created vor 8 Jahre, 1 Monat. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 6 Antworten, has 2 Stimmen.

Last updated by Engedi vor 8 Jahre, 1 Monat.

Assisted by: Beda.

Author
Artikel
#370469
problem.jpg

I am trying to display a list of child posts on a parent post. I want to have an infinite scrolling to show the child posts. But it does not work at all. I tried with the views pagination, it works on page 2, but no more than that. I then use wp-pagenavi. I inserted following code into function.php:

// Get the page number into wp_pagenavi
function pagenavi_paged($q) {
if (get_query_var('paged')) {
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$q->set('paged', $paged);
}
}
add_action('pre_get_posts', 'pagenavi_paged');
  
// Add a custom wp_pagenavi shortcode
function wpv_pagenavi($args, $content) {
global $WP_Views;
return wp_pagenavi( array('query' => $WP_Views->post_query, 'echo' => 0) );
}
add_shortcode('wpv-pagenavi', 'wpv_pagenavi');


The same 'view' works find on a 'page' for the wpv-pagenavi, but it does not work on custom post type. It does create the ..../custom-post-type/post-title/page/2 , but when click on it, it redirect back to .../custom-post-type/post-title/

And i cant get the infinite scrolling working also.

#370568
Bildschirmfoto 2016-02-25 um 17.41.35.png

Views is a tool that provides DDBB Display engines and pagination + search features.

This is not done via PHP but in the WP Admin > Views > new/edit

You can use the Views API to display a view, but we do assist Custom PHP Code that builds what a View does build in the GUI.
https://toolset.com/documentation/user-guides/views-api/
https://toolset.com/forums/ > Support Policy

I tested Infinite scrolling locally, and this seems to work as expected.
https://toolset.com/documentation/user-guides/infinite-scrolling-in-views/

Also, when you use Infinite Scrolling, no other pagination navigation can be used on the View.
This is by design.

Can you elaborate what did not work with the pagination, and how you try to display a list of child posts on a parent post?

This is usually done with a View, that queries Child Posts and has a Query Filter of "Posts that are children of the Post where this View is inserted"
https://toolset.com/documentation/user-guides/displaying-related-child-posts/

Please could you provide me the additional Infos?

Thank you for your patience.

#370584

Thank you for your reply.

First of all, i have read here that infinite scrolling is not working with the latest version of views.

https://toolset.com/forums/topic/infinite-scroll-is-not-working-on-view-1-12/

And i have tested on my website, it does not work.

So i change the way to show my child post by using pagination.

I have 2 custom post type: Quote Author, Quotes

Parent: Quote Author
Child: Quotes

So, on the individual Quote Author page, in this case Albert Einstein is the quote author. So the Permalink structure is ..../quote-author/albert-einstein

On this page, i want to display all the quotes by Albert Einstein. So in the view, i have the post relationship filter applied.

And i set the Pagination enabled with manual transition, Pagination updates the entire page.

Then i insert [wpv-pagenavi] into the filter control. Like below:

[wpv-filter-start hide="false"]
[wpv-filter-controls][wpv-pagenavi][/wpv-filter-controls]
[wpv-filter-end]

The end result is shown in the first post image.

I have done everything just like in the manual.

when i click on the page 2, or 3 --> ..../quote-author/albert-einstein/page/2
it will be redirect back to the .../quote-author/albert-einstein/

So, the pagination is not working.

I have tested the same view in the new Page i created. It worked like charm.
But when i tested in a new Post, it gives the same problem as in the Custom Post Type.

I hope you understand what is the problem. And please help me.

#370622

I apologize, but you seem you are using a Custom Code to create [wpv-pagenavi]

This is not a Views ShortCode, and we do not support debugging of Custom Code, specially if Views provides the exact feature you like to achieve.

You have not inserted a ShortCode following this manual:
https://toolset.com/documentation/user-guides/views-pagination/
(please correct me if I am wrong.)

This are the possible Pagination ShortCodes.

[wpv-pager-current-page]
[wpv-pager-total-pages]
[wpv-pager-prev-page][wpml-string context="wpv-views"]Previous[/wpml-string][/wpv-pager-prev-page][wpv-pager-next-page][wpml-string context="wpv-views"]Next[/wpml-string][/wpv-pager-next-page][wpv-pager-nav-links]
[wpv-pager-nav-links ul_class="wpv_pagination_dots" li_class="wpv_pagination_dots_item" current_type="link"]
[wpv-pager-nav-dropdown]

The Pagination kind you want to achieve and show in your Screenshot is achievable with the below 3 ShortCodes and Custom HTML:

[wpv-pagination]
  [wpv-pager-current-page] [wpv-pager-total-pages]
  [wpv-pager-nav-links]
[/wpv-pagination]

This can be set up with the GUI following the above DOC, on my local tests it worked fine.

The thread you linked to, this will be solved in Views 1.12.1:
There is no solution as of now, but a fix will be included in Toolset Views 1.12.1.

Please let me know if you have further questions regarding the issue mentioned in this Thread

Thank you for your patience.

#370735
problem2.jpg

Hi, can you please help me with the custom HTML or CSS code for the following shortcode:

 [wpv-pagination]
  [wpv-pager-current-page] [wpv-pager-total-pages]
  [wpv-pager-nav-links]
[/wpv-pagination] 

When i insert code above, it is only showing the list of page in bullet form as shown in image.

How do i achieve the desire format in my first post?

#371065

Can you please reply me so that i can finish up my project? Thank you very much.

#371087

It is ok. I have figured it out myself.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.