Merge branch 'develop' of https://github.com/tainacan/tainacan into develop
This commit is contained in:
commit
e77176268b
|
@ -329,14 +329,14 @@ class Search_Engine {
|
|||
$searchand = '';
|
||||
$searchSlug = '';
|
||||
foreach ( $search_terms as $term ) {
|
||||
$term = $wpdb->prepare("%s", $exact ? $term : "%". sanitize_title_with_dashes($term) . "%");
|
||||
$searchSlug .= "{$searchand}(tter.slug LIKE $term)";
|
||||
$term = $wpdb->prepare("%s", $exact ? $term : "%". $term . "%");
|
||||
$searchSlug .= "{$searchand}(tter.name LIKE $term)";
|
||||
$searchand = ' AND ';
|
||||
}
|
||||
|
||||
$term = $wpdb->prepare("%s", $exact ? $term : "%". sanitize_title_with_dashes($s) . "%");
|
||||
$term = $wpdb->prepare("%s", $exact ? $term : "%". $s . "%");
|
||||
if ( count( $search_terms ) > 1 && $search_terms[0] != $s ) {
|
||||
$searchSlug = "($searchSlug) OR (tter.slug LIKE $term)";
|
||||
$searchSlug = "($searchSlug) OR (tter.name LIKE $term)";
|
||||
}
|
||||
if ( !empty( $searchSlug ) )
|
||||
$search = " OR ({$searchSlug}) ";
|
||||
|
|
|
@ -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 "<div id='tainacan-items-page' $props ></div>";
|
||||
|
||||
|
@ -278,7 +285,11 @@ function tainacan_register_view_mode($slug, $args = []) {
|
|||
*/
|
||||
function tainacan_get_item($post_id = 0) {
|
||||
$post = get_post( $post_id );
|
||||
|
||||
|
||||
if (!$post) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$theme_helper = \Tainacan\Theme_Helper::get_instance();
|
||||
|
||||
if (!$theme_helper->is_post_an_item($post))
|
||||
|
|
Loading…
Reference in New Issue