Mejora tu sitioWORDPRESS · WEB · IDEAS
English

Editing & design

Let a category archive keep its own query

Share the archive design without replacing each category’s own selection of posts.

A category archive should show the posts belonging to the category being visited. That sounds obvious until a template is given a fixed query. If every category page suddenly displays the same collection, the design may be ignoring the current archive context. Treat the archive's selection rules and its visual card layout as separate layers.

In a block theme, an archive template can contain a Query Loop that follows the default query. WordPress supplies the relevant context for the requested archive. A custom query instead uses settings you define. Both have legitimate uses, but a fixed category selection is usually not what you want in a template intended to serve many categories.

Imagine separate archives for Recipes and Kitchen techniques. Their shared template can use the same image size and title styling while receiving different posts from the current request. Hard-coding Recipes into the shared query may make both destinations show recipes. Editing the card appearance does not require replacing the selection logic.

Requested category supplies the query context, then the shared card template displays the matching posts.
Explanatory diagramThe current request supplies the category context. A shared visual layout should preserve that context instead of forcing every archive to use one fixed category. Open the image to see the full detail.
Read the diagram as text
  • Requested archive: A visitor opens Recipes or Kitchen techniques.
  • Current category context: The default archive query identifies the relevant collection.
  • Shared card layout: The same presentation displays different matching posts.

Test two clearly different categories to reveal a fixed-query mistake.

Test two categories, not one

Choose categories with clearly different posts and open both public archives. Check the heading, article membership and pagination. The editor preview can represent only one context at a time, so a correct-looking preview does not establish that the template behaves correctly for every category.

Keep archive introductions tied to the right source. A dynamic archive title or description can change with the category. A manually typed heading in the shared template stays the same unless another mechanism changes it. Use fixed text only when it genuinely applies to all the archives using that template.

If one category needs a distinct design, investigate the theme's supported template hierarchy or an intentionally separate template rather than adding a fixed query to the common layout without understanding its scope. Record that exception for future editors. A useful archive system shares presentation where appropriate while preserving the subject of each destination. That separation lets the collection grow without requiring a newly hand-built page for every category.