Skip to content

Add search controls and fix search pagination#636

Merged
akirk merged 5 commits into
mainfrom
fix/search-controls-and-pagination
Apr 4, 2026
Merged

Add search controls and fix search pagination#636
akirk merged 5 commits into
mainfrom
fix/search-controls-and-pagination

Conversation

@akirk

@akirk akirk commented Apr 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix search pagination: Added s to get_minimal_query_vars() so the search term is included in the query vars passed to JavaScript — infinite scroll now correctly loads filtered results instead of unfiltered posts.
  • Search-specific controls: When a search is active, replace the regular feed chips (post formats, reactions, hidden items) with search-relevant chips: "Clear search", sort order toggle (oldest/newest first), and compact mode.
  • Order parameter support: Added ?order=ASC/DESC query parameter handling in friend_posts_query() so sort order actually takes effect.
  • Applied changes consistently to both the classic template (main-feed-header.php) and the block renderer (class-blocks.php).

Test plan

  • Visit /friends/?s=someterm and verify search results appear with "Clear search" and "Oldest first" chips
  • Click "Oldest first" and verify results reorder and the chip toggles to show both "Oldest first" (active) and "Newest first"
  • Scroll down to trigger infinite scroll and verify subsequent pages still contain search-filtered results
  • Click "Clear search" and verify return to normal feed with regular chips
  • Verify the block-based theme shows the same behavior
Changelog
  • Automatically create a changelog entry from the details below

Type

  • Fixed

Message

Fix search pagination losing search results on infinite scroll and add search controls (clear search, sort order).

- Include 's' in get_minimal_query_vars() so the search term persists
  during infinite scroll pagination
- Show search-specific chips (clear search, sort order) instead of the
  regular feed chips (post formats, reactions) when a search is active
- Support ?order=ASC/DESC query parameter for sorting search results
- Apply changes consistently to both the template and block renderers
@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Test this PR in WordPress Playground

You can test this pull request directly in WordPress Playground:

Launch WordPress Playground

This will install and activate the plugin with the changes from this PR.

@akirk akirk merged commit 4c9d9a3 into main Apr 4, 2026
26 checks passed
@akirk akirk deleted the fix/search-controls-and-pagination branch April 4, 2026 04:55
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.

1 participant