Goal
Add a copy-and-paste Code Library example that restricts Contextual Related Posts results to posts published before the current source post.
Existing coverage
The existing crp-change-query-dates.php example demonstrates crp_query_date_query for same-day matching. It does not cover older-than-source behavior, which is the practical snippet-level alternative to YARPP's past_only option.
Deliverables
- Add
contextual-related-posts/crp-older-posts.php or an equally clear filename under the queries category.
- Use
crp_query_date_query and derive the source post publication date safely from the query arguments or current post.
- Define and document the boundary behavior so posts published after the source are excluded.
- Add a uniquely prefixed callback, PHPDoc, and matching Markdown companion under
src/content/snippets/contextual-related-posts/.
- Include the timezone and timestamp-precision caveat needed for a reliable date comparison.
- Set
requiresPro: false, list the correct requirements, and link the crp_query_date_query hook reference.
This should remain a focused query example; it should not add a CRP setting or attempt to implement YARPP compatibility in the plugin.
Goal
Add a copy-and-paste Code Library example that restricts Contextual Related Posts results to posts published before the current source post.
Existing coverage
The existing
crp-change-query-dates.phpexample demonstratescrp_query_date_queryfor same-day matching. It does not cover older-than-source behavior, which is the practical snippet-level alternative to YARPP'spast_onlyoption.Deliverables
contextual-related-posts/crp-older-posts.phpor an equally clear filename under thequeriescategory.crp_query_date_queryand derive the source post publication date safely from the query arguments or current post.src/content/snippets/contextual-related-posts/.requiresPro: false, list the correct requirements, and link thecrp_query_date_queryhook reference.This should remain a focused query example; it should not add a CRP setting or attempt to implement YARPP compatibility in the plugin.