- This topic is empty.
-
AuthorPosts
-
May 13, 2014 at 1:01 pm #170059
mikes02
ParticipantI have a page that is using a custom query to display the 6 latest posts from a specific category, at the bottom I would like to have a button that when clicked it loads the next 6 articles, I have scoured the internet for something to accomplish this and it seems none of the tutorials work with custom queries or will load the next set of articles on click, I don’t want to replace the 6 articles that show originally, I just want to load in 6 more, and keep the process repeating until there are no articles left. Any ideas would be greatly appreciated.
May 13, 2014 at 1:42 pm #170065nixnerd
ParticipantDude, I gotta ask, why wouldn’t you just use infinite scroll? From a UI/UX standpoint, scroll is less steps than clicking and they will just keep loading forever. They’ll even loop around to the beginning! I’m pretty sure you can hack that to stop when it’s reached the oldest post but if not… viola, there you go.
May 13, 2014 at 1:44 pm #170066mikes02
ParticipantBecause it isn’t the functionality that was asked for, I am looking for a way to load more on click.
May 13, 2014 at 2:32 pm #170073John
ParticipantNM
May 13, 2014 at 2:33 pm #170074mikes02
ParticipantThat’s not at all what I’m asking about.
May 13, 2014 at 2:53 pm #170080nixnerd
ParticipantBecause it isn’t the functionality that was asked for
K. Sorry. Just trying to suggest something easier. My bad.
I don’t think there’s an easy way of accomplishing this, nor do I think there is just one way. You could look at the infinite scroll code and create a function to trigger it upon the clicking of a button, rather than scrolling. You could make a container that has a height of 0 until said button is clicked. Again… this will need to be a JS function. Obviously this container will hold the other posts. Upon clicking it, the height will go from ‘0’ to ‘auto’.
What I’m trying to say is… this will require a mix of PHP, CSS and JS/Jquery. There MIGHT be a plugin that does this. Try looking. But, if you have to build it yourself. There is n number of ways to do that. Pick your poison.
BTW, what are you looking at in your photo?
October 22, 2014 at 3:34 pm #186848jekkilekki
ParticipantI’m also looking to do the same thing in my plugin. Did you ever figure this out?
I found this link about using AJAX to do it. Going to have a look at it and see if I can make it work.
Also, here’s some similar code (maybe the same) on GitHub.
October 22, 2014 at 4:16 pm #186849Alen
ParticipantI’m on mobile now, but this https://wordpress.org/plugins/ajax-load-more/ I’ve worked with and it should do what you require.
December 21, 2015 at 3:37 am #236058GMK Hussain
ParticipantDecember 21, 2015 at 4:43 am #236062GMK Hussain
Participant -
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.