- How do I dynamically load more results in WordPress?
- How do I add a load more button to a custom post type?
How do I dynamically load more results in WordPress?
To load more results, we have to use the wp_ajax_$action and wp_ajax_nopriv_$action hooks. These call the load_more_posts() function where ever more results are needed. The post type can vary so the same function can be used but it can differ in which card layout is returned.
How do I add a load more button to a custom post type?
insertAfter('#ajax-posts'); // Move the 'Load More' button to the end of the the newly added posts. ); With the above code, you should now have a load more button at the bottom of your posts, and once you click this it will display further posts. This can also be used with CTP (custom post type).