Repository navigation
Preserved queries in onboarding archives - #195
Conversation
There was a problem hiding this comment.
🟡 Changes requested
The three archive variants now inherit the archive query, but sites that imported a variant earlier keep the old saved template.
Validation details
- Files reviewed: 4/4 changed files.
- The new test passes at HEAD on PHP 7.4.33 and WordPress 7.1.3.
use-php.sh 7.4 2>&1 | tail -3; php -v | head -1; cd /var/www/html/wp-content/themes/raft && set -o pipefail; timeout 250…printedOK (1 test, 7 assertions)(run R7) - The new test fails with the old template files.
cd /var/www/html/wp-content/themes/raft-base && set -o pipefail; timeout 250 vendor/bin/phpunit --filter 'Test_Onboardin…printedFailed asserting that false is true.(run R8) - An in-process render of each HEAD variant on a category archive listed only that category's posts, two per page, on pages 1 and 2.
cd /var/www/html/wp-content/themes/raft && set -o pipefail; timeout 250 vendor/bin/phpunit --filter 'R2aRenderTest::' 2>…(run R36, exit 0)
Untested areas
- Enhanced client-side pagination on Archive Cards and Archive Rows was not checked in a browser. The sandbox site did not load Raft over HTTP.
🤖 Automated review · run code-review-agent_6ae0968d9c9388.72620238.
🤖 Review agent — review posted ✅ on c0489c0d · changes requested · 1 finding · 16 min
Run code-review-agent_6ae0968d9c9388.72620238 · trail
|
|
||
| <!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|80","bottom":"var:preset|spacing|80","left":"var:preset|spacing|50","right":"var:preset|spacing|50"},"margin":{"top":"0","bottom":"0"}}},"backgroundColor":"raft-bg","layout":{"inherit":true,"type":"constrained"}} --> | ||
| <div class="wp-block-group has-raft-bg-background-color has-background" style="margin-top:0;margin-bottom:0;padding-top:var(--wp--preset--spacing--80);padding-right:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--50)"><!-- wp:query {"queryId":4,"query":{"perPage":3,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false},"layout":{"contentSize":null,"type":"constrained"}} --> | ||
| <div class="wp-block-group has-raft-bg-background-color has-background" style="margin-top:0;margin-bottom:0;padding-top:var(--wp--preset--spacing--80);padding-right:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--50)"><!-- wp:query {"queryId":4,"query":{"perPage":3,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true},"layout":{"contentSize":null,"type":"constrained"}} --> |
There was a problem hiding this comment.
correctness This fixes only sites that run onboarding after the update. Otter saves the chosen variant's markup into the site's archive wp_template post at import time. Sites that already picked Archive Boxed, Cards or Rows keep "inherit":false after the update. Their category archives still list posts from all categories. This assumes those sites imported through the same path as Otter v3.2.8. Add a one-time upgrade routine that updates a saved Raft archive template whose Query block still matches a shipped variant with "inherit":false, and sets it to true. Add a PHPUnit case that saves the old variant markup as a wp_template post, runs the routine, and asserts inherit is true.
There was a problem hiding this comment.
Not applied. Rewriting a site's saved archive template on upgrade would edit content the user owns and may have customised after onboarding, so the theme shouldn't change it silently. This PR fixes all new onboarding selections. Sites that already imported a variant can fix it by re-running onboarding's Archive step, or with "Inherit query from template" on the archive template's Query Loop.
|
🎉 This PR is included in version 1.1.17 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
Updated the Query Loop settings in the Archive Boxed, Archive Cards, and Archive Row onboarding layouts to use
inherit: true, matching the default archive template. These layouts now respect the current archive query, displaying only the relevant category, tag, author, or date archive posts and honoring pagination configured through Settings → Reading.Closes #187