-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
where is the query that gets favorite posts ? is there any way to add pagination ? #109
Comments
Hey @logicano, are you familiar with using WordPress filters? I haven't had time to personally test this out but there's a filter inside of the https://github.com/kylephillips/favorites/blob/master/app/Entities/User/UserRepository.php#L80
Seems like you would either have to implement some kind of custom pagination within your template OR follow a similar path that @ben-heath mentioned in #50 (comment) where you retrieve all of the favorite post ID's and then pass them into a custom WP_Query loop. In there you can specify # of posts per page and provide "next" and "back" links like in his code example.
|
Really , I cant thank you enough you really helped me . but i still curious about where how this plugin gets posts from Database |
Hey @logicano, Most of the queries to grab the favorite information is stored on post meta or is retrieved by manually creating a DB query e.g. all favorite counts are retrieved in the The saved settings created by the user inside WP Admin are retrieved by the |
Hey @gfargo, Do you have any idea why the ajax updating stops working when custom WP_Query loop is used? |
Hey @altjonK, not sure I follow. Do you have this documented in another issue? |
@gfargo Hello, can the article's favorite list be sorted according to the time of the collection operation?And can I turn the page to display numbers? Not just new and old.I looking forward to your reply, thank you very much. |
@zrpgood Given the approach above, if you wanted to add numbered pagination to your page you'd want to use the It will output both the links to For sorting, have you checked out the |
Hi @gfargo, first of all thank you for providing the solution. However I bumped into a problem. The list that shows all the favorites of a particular user doesnt seem to update with this query. is there anyway to fix this? I know that this is an old thread, but I was kinda hoping someone is facing the same problem? I figured is the ajax not working for some reason. |
Hello @gfargo, where should I add your code to add a pagination in the favorite list page? |
Hey @hellohana, sorry for the abysmally slow reply, have been distracted in typescript land lately. When are you expecting the query to update? Because this is PHP, this query will only be run when the user views the page. If you want it to update after the user clicks something to "favorite" you'd likely need to write some logic in JS to query the WordPress API for the same data and update the DOM with the new results. |
Wonder if everyone would benefit from wrapping up the pagination functionality into a shortcode? The shortcode could accept various params to control the output. Admittedly, it's been awhile since I've looked/contributed to this lib, so maybe a better route would be adding a param to an existing shortcode to toggle pagination instead 💭 |
in the beginning i want to thank you for the great plugin ,
actually, i was trying to add pagination to the favorites plugin by connecting it with another pagination plugin
but i cant reach the variable that does the query which gets the favorite posts from the database .
iam searching for a variable that contains code like "wp_query" or so ican make pagination or limit posts
that appears .
i have searched all the files but i found nothing
The text was updated successfully, but these errors were encountered: