Search by

jcodigital / jcore-dynamic-archive

jcore

JCORE Dynamic Archive module

Package info

git.jcore.fi/jcore-dynamic-archive.git

Type:wordpress-plugin

pkg:composer/jcodigital/jcore-dynamic-archive

Statistics

Installs: 28

Dependents: 0

Suggesters: 0

v1.1.0 2026-10-23 13:44 UTC

This package is auto-updated.

Last update: 2026-10-23 13:44:42 UTC


README

A WordPress plugin that adds a filterable, sortable and searchable post archive block, plus a latest/related posts block and a post picker block. Front-end filtering, pagination and "load more" are powered by the Interactivity API and its router, so the archive updates without full page reloads while every state stays linkable through the URL.

Templates are rendered with Timber, and themes can override any of them.

Requirements

  • WordPress 6.7 or newer
  • PHP 8.1 or newer
  • Timber 2.x (installed by the theme or site, not bundled with this plugin)

An admin notice is shown if Timber is missing.

Installation

Install via Composer:

composer require jcodigital/jcore-dynamic-archive

composer/installers places the package in the plugins directory. Activate it as usual, or load it from a must-use plugin together with your Composer autoloader.

Updates are delivered through jcore-update when that package is available.

Blocks

Dynamic Archive (jcore/dynamic-archive)

A post archive with optional front-end controls.

Query

  • Post type selection, or Inherit settings from query to follow the current archive (term, author, post type, date, search or blog page).
  • Order and order by (date, title, modified, author, ID, menu order).
  • Sticky posts: include, exclude or show only sticky posts.
  • Hide children (for hierarchical post types).
  • Show all languages (Polylang).

Filters

  • Taxonomy filters per taxonomy, displayed as checkbox, radio, dropdown or multiselect.
  • Hierarchical filters: child terms stay hidden until their parent is selected, and can use a different filter type than the parents.
  • Forced terms: restrict the archive (and its filter) to specific terms.
  • Free-text search with a configurable label. If Relevanssi is active, it is used for the search.
  • User-selectable sorting by date, title, or any taxonomy of the post type.

Layout and pagination

  • Columns, masonry grid and posts per page.
  • Numbered pagination, or infinite scroll ("load more").

Latest Posts (jcore/latest-posts)

Shows the newest posts of the selected post types, optionally limited to specific terms, with an optional heading, columns, order and sticky post handling. It can also inherit the current archive query.

The Related Posts (JCORE) variation shows posts that share terms with the current post. With backfill enabled, remaining slots are filled with other recent posts of the same post type.

Post Picker (jcore/post-picker)

Shows a hand-picked set of posts, or the newest posts in one term, with an optional heading and columns.

  • Posts I pick: search posts of any viewable post type, add them, and put them in order. They are shown in that order. Posts that are not published (or no longer exist) are flagged in the editor and skipped on the front end.
  • Newest posts in a category: choose a taxonomy and a term, the number of posts and the order (date or title). Posts in child terms are included, and the post the block is shown on is left out.

Theme integration

Post teaser (required)

The plugin does not ship a post teaser template. Your theme must provide one, looked up in this order:

BlockTemplates tried
Dynamic Archivedynamic-archive/partials/tease.twig, then partials/tease.twig
Latest Postslatest-posts/partials/tease.twig, then partials/tease.twig
Post Pickerpost-picker/partials/tease.twig, then partials/tease.twig

The template receives post (a Timber post) and nr (the 1-based loop index).

Overriding templates

The plugin's blocks/templates/ directory is registered as a Timber location after the theme's own locations. To override a template, place a file with the same relative path in your theme's Timber views directory, e.g. dynamic-archive/partials/filters/filter-checkbox.twig.

Pagination and "load more" can also be overridden via dynamic-archive/overrides/partials/pagination.twig and dynamic-archive/overrides/partials/load-more.twig.

Overridden templates must escape any block attribute they print (e.g. {{ attributes.searchLabel|e }}).

URL parameters

The archive state lives in the query string, prefixed per block instance as dynamic-archive-{instanceId}-:

ParameterExample
…-taxonomy[{taxonomy}][]dynamic-archive-3-taxonomy[category][]=12
…-sortdynamic-archive-3-sort=title-ASC, tax:category-DESC
…-searchdynamic-archive-3-search=hello
…-archive-pageddynamic-archive-3-archive-paged=2

Taxonomy filters use term IDs by default. Switch to slugs with the jcore_dynamic_archive_taxonomy_field_type filter, and change the prefix with jcore_dynamic_archive_param_prefix.

Hooks

PHP filters

FilterPurpose
jcore_dynamic_archive_argsFinal WP_Query args of the archive.
jcore_dynamic_archive_tax_queryQuery args after taxonomy filters are applied.
jcore_dynamic_archive_tax_query_relationRelation between forced term groups (default OR).
jcore_dynamic_archive_handle_taxonomy_sortingQuery args when sorting by taxonomy.
jcore_dynamic_archive_inherited_query_argsArgs inherited from the current main query.
jcore_dynamic_archive_inherit_stickyApply sticky settings when inheriting the query (default false).
jcore_dynamic_archive_taxonomies_inheritTaxonomy filter configuration used when the block inherits the query.
jcore_dynamic_archive_taxonomies_filterThe filter data (taxonomies and terms) passed to the templates.
jcore_dynamic_archive_taxonomies_filter_query_awareOnly show terms that match posts in the current result (faceted filters, default false).
jcore_dynamic_archive_facet_term_query_argsQuery args used to find applicable terms for faceted filters.
jcore_dynamic_archive_use_post_type_term_usageOnly show terms used by the selected post type (cached, default false).
jcore_dynamic_archive_term_post_type_usage_cache_ttlCache TTL for the term usage lookup (default one day).
jcore_dynamic_archive_term_post_type_usage_post_statusesPost statuses counted in the term usage lookup.
jcore_dynamic_archive_taxonomy_field_typeid or slug for taxonomy URL parameters.
jcore_dynamic_archive_param_prefixURL parameter prefix per block instance.
jcore_dynamic_archive_infinite_scroll_max_pagesHighest page reachable with "load more" (default 50).
jcore_dynamic_archive_interactivity_contextInteractivity API context of the block.
jcore_dynamic_archive_interactivity_stateGlobal Interactivity API state.
jcore_latest_posts_argsWP_Query args of the Latest Posts block (also applied to the backfill query).
jcore_post_picker_argsWP_Query args of the Post Picker block.

Example: enable faceted filters for all archives.

add_filter( 'jcore_dynamic_archive_taxonomies_filter_query_aware', '__return_true' );

JavaScript filters (block editor)

FilterPurpose
dynamicArchive.forbiddenPostTypesPost types hidden from the post type selector (default ['attachment']).
jcore.latestPosts.showPostTypesPost types offered in the Latest Posts block.
jcore.latestPosts.taxonomiesTaxonomies offered for term selection in the Latest Posts block.
jcore.latestPosts.maxSelectedMaximum number of selectable post types (default -1, unlimited).
jcore.latestPosts.maxItemsMaximum value for posts per page (default 25).
jcore.postPicker.postTypesPost type slugs searched by the Post Picker (default: all viewable post types).
jcore.postPicker.taxonomiesTaxonomies offered in the Post Picker's term mode.
jcore.postPicker.maxItemsMaximum number of posts in the Post Picker's term mode (default 25).

Development

The block sources live in blocks/ and are built with @wordpress/scripts, using pnpm.

make install   # composer install + pnpm install
make dev       # watch and rebuild blocks
make build     # production build into blocks/build
make make-pot  # regenerate languages/jcore-dynamic-archive.pot (requires WP-CLI)

Don't edit files under blocks/build/; they are generated from blocks/src/.

Commits follow Conventional Commits. The changelog and releases are generated from them.

Changelog

See CHANGELOG.md.

License

GPL-2.0-only. See composer.json.