diff --git a/src/theme-helper/template-tags.php b/src/theme-helper/template-tags.php index 987955aef..9dc6e963d 100644 --- a/src/theme-helper/template-tags.php +++ b/src/theme-helper/template-tags.php @@ -182,13 +182,17 @@ function tainacan_the_faceted_search() { $props = ' '; + $default_view_mode = apply_filters( 'tainacan-default-view-mode-for-themes', 'masonry' ); + $enabled_view_modes = apply_filters( 'tainacan-enabled-view-modes-for-themes', ['table', 'cards', 'masonry'] ); + // if in a collection page $collection_id = tainacan_get_collection_id(); if ($collection_id) { + $props .= 'collection-id="' . $collection_id . '" '; $collection = new \Tainacan\Entities\Collection($collection_id); - $props .= 'default-view-mode="' . $collection->get_default_view_mode() . '" '; - $props .= 'enabled-view-modes="' . implode(',', $collection->get_enabled_view_modes()) . '" '; + $default_view_mode = $collection->get_default_view_mode(); + $enabled_view_modes = $collection->get_enabled_view_modes(); } // if in a tainacan taxonomy @@ -197,6 +201,9 @@ function tainacan_the_faceted_search() { $props .= 'term-id="' . $term->term_id . '" '; $props .= 'taxonomy="' . $term->taxonomy . '" '; } + + $props .= 'default-view-mode="' . $default_view_mode . '" '; + $props .= 'enabled-view-modes="' . implode(',', $enabled_view_modes) . '" '; echo "
";