Skip to content

Use main query for archive#98

Open
girishpanchal30 wants to merge 2 commits intodevelopmentfrom
bugfix/91
Open

Use main query for archive#98
girishpanchal30 wants to merge 2 commits intodevelopmentfrom
bugfix/91

Conversation

@girishpanchal30
Copy link
Copy Markdown
Contributor

Summary

Use the main query on the archive page and set the posts per page to 4.

Closes #91

@pirate-bot
Copy link
Copy Markdown
Contributor

pirate-bot commented Apr 6, 2026

Plugin build for 5fb4da7 is ready 🛎️!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes archive pages (e.g., category/tag archives) so they correctly use the main WordPress query context (instead of querying all posts), and enforces a 4-posts-per-page archive size to match the theme’s intended layout.

Changes:

  • Updated the templates/archive.html Query Loop block to inherit the main query (so taxonomy archives only show posts from the current term).
  • Added a pre_get_posts hook to set posts_per_page to 4 for the main archive query.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
templates/archive.html Switches the archive Query Loop to inherit the main query so category/tag context is respected.
inc/Core.php Hooks pre_get_posts to force archive main queries to 4 posts per page.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Category archive page is displaying all posts, not just posts from that particular category

4 participants