Skip to main content

Timeline for First archive page with a few posts

Current License: CC BY-SA 4.0

15 events
when toggle format what by license comment
Jan 29, 2022 at 2:00 comment added Sally CJ I'm glad to hear that :) But one thing: You should use a child theme instead of modifying files (like the functions.php file) in the parent theme, unless of course if you developed the theme yourself. So for example, copy the entire pagination function (those lines 775-842) from the parent theme to your child theme's functions file, rename the function to my_numeric_posts_nav and make the adjustment (in step 2) as shown in my answer. Then in your archive template, use my_numeric_posts_nav( $query ) instead. 🙂
Jan 28, 2022 at 18:05 comment added Alex Osipov Thank you Sally CJ, it worked! Thanks to you! ...And I learned something too:))) You ROCK!
Jan 28, 2022 at 18:04 vote accept Alex Osipov
Jan 28, 2022 at 5:32 comment added Sally CJ Actually, I just wanted to see the code for the pagination function, i.e. lines 775 to 842 here.. :) Anyway, thanks again and please check my answer - follow the first 3 steps, then the other 3 steps at the bottom. Hopefully that's not too hard for you.. and remember to let me know how it goes!
Jan 28, 2022 at 5:25 answer added Sally CJ timeline score: 1
Jan 27, 2022 at 16:35 comment added Alex Osipov Yes i am using Page with template that i posted above, and slug is https://example.com/archive-blog this is my functions code: [pastebin.com/jQA3cgCx], and this is Next Prev code: [pastebin.com/GcCNTjcs] Hope it enough to help you?
Jan 27, 2022 at 10:05 comment added Sally CJ The function code is incomplete, so can you post the complete function code on Pastebin.com and share the link to that Paste? Also, I edited your post based on your first comment, but can you confirm if you're using a Page and that its slug is archive? What does the URL look like; is it like https://example.com/archive?
Jan 27, 2022 at 9:59 history edited Sally CJ CC BY-SA 4.0
Modified wording and added details from the author's comment
Jan 26, 2022 at 23:48 comment added Alex Osipov Hey Sally CJ, i posted the code for numeric_posts_nav() function, but i have no idea how to use pre_get_posts vs query_posts(), can you please explain to me like i am 10 year old:)) What function should i use in function.php? Or i use snippet plugin, and how i call it in my case in my page template (i posted above). Sorry i know a lot about CSS and HTML, but when it comes to PHP, i have no idea, man:)
Jan 26, 2022 at 19:45 history edited Alex Osipov CC BY-SA 4.0
added 905 characters in body
Jan 26, 2022 at 10:32 comment added Sally CJ So you have a Page (post type page) with the slug archive, right? Can you add that detail and the ones in your previous comment to your post along with the code for the numeric_posts_nav() function?
Jan 26, 2022 at 7:09 comment added Alex Osipov Hi Sally CJ, this is page-archive.php. I am using as a template to display all my posts/recipes.
Jan 26, 2022 at 4:39 comment added Sally CJ You should not call query_posts() in your template. Use the pre_get_posts hook instead to modify the main query's arguments like posts_per_page. And by "archive template", are you referring to the archive.php file?
Jan 26, 2022 at 0:29 answer added tiago calado timeline score: 0
Jan 25, 2022 at 22:46 history asked Alex Osipov CC BY-SA 4.0