Hooks Help

Where do I add the hook for this? It is three functions deep.
tainacan_the_metadata > tainacan_get_the_metadata > >get_metadata_as_html.
I would like to pull the session data and the link associated, like this:
and put it here:

The function in question:

I would like to pass

							'metadata'	=> 'session'

to it. I guess I am having trouble finding hooks.

Hi @eeszarek, maybe this one?

Could you explain in more details what you are trying to achieve? Maybe there is a way vie theme but there are several filters in the _as_html functions. In this case, the $item_metadatum object should contain information from the current item, the metadata and its value.

1 Like

Hello, I am still struggling with this.
My single-item pages look like this.

I can click through the value_as_html link to go to this:

but I would like to add a navigation part to my first page, like this from Association for cultural equity.

I have tried various API calls but I am really struggling with it.

Hi @eeszarek!

If I understood right, you would like to show items that belong to this Taxonomy Term (Murrels Inlet June 1939). In the I Lost My Mother’s Barn Key item page, including the filters, in a sort of “Related items section”. Is that it?

If it is, two things come to my mind. One is that you could probably achieve this easily with a Relationship metadata instead of a Taxonomy. Maybe using the “Items related to this” feature combined with the Detailed Metadata Displayed in the relationship? In any case that would still not display filters, as in our default “related items” views we usually have a Carousel or more simple list, that would end with a button targeting the full items list with filters. Here you can see them in the theme-side:

That said, another thing that may be what you are looking for is the ability to render a complete faceted search (the items list with filters) in this page. There is a function named tainacan_the_faceted_search() that can also be displayed using a shortcode (tainacan-search). This function accepts several parameters. You can read all of them here:

If you pass a term_id, it will render the list of items that were tagged to that taxonomy term. I’ve never did anything such as displaying a new items list inside the item page… but it might work.

Let me know how this goes!

That is awesome, thank you so much. I should have just asked for clarification earlier! I will give this a try, it looks like it is exactly what I need.

Glad to help!

Also, the “Items related to this” section is “relatioship-metadata” based, but if you would like to display related items based on a taxonomy, the Blocksy theme has this feature by default, you may give it a try using our integration plugin. Let me know if you go that way so I can give further clarifications.

We use the Tainacan Interface theme on our website. Does that change how it works?

It would be another theme with another appearance. You may want to try, but it is up to you to see which you prefer.

Here is the theme:

Here is our integration plugin:

And for enabling related items, you would look for something like “Customizer” → “Item from collection X” → “Related posts”. I can give better details later if tou go that way.

Thank you so much for this! I really made some progress.


Now I am wondering if there is a way to make a query from these items. For example, would it be possible to do the faceted search then add a metaquery?
Something like:

$items = tainacan_get_items(array(
    'meta_query' => array(
            'key' => 'original_filename',
            'value' => 'ace_mi_19390608_2719B*',
            'compare' => 'LIKE',

So that the list would only be

Uhmmm, sadly no, the faceted search function does not accept queries like that. Partially because itself builds internally the queries to be performed according to the existing filters, view modes, etc.

If you want to have more control over the queries, you could build a WP_Query manually with the meta and tax queries and then build the loop by your own…but I guess that may be too much work depending on what you are trying to achieve. If a simple “carousel” or “grid” view suffice you, there is the get_tainacan_items_carousel() and get_tainacan_dynamic_items_list() functions, which accept a list items as input. Take a look here:

This is the function definition inside the theme helper. To call them, you would use a function from the template tags, like this:

One note, this functions are the same evoked to render their Gutenberg blocks counterparts. So 99% of what you can do with the blocks you can do with them. In this case, you would build the WP_Query to fetch exactly the items that you want and then would pass them as argument in the selected_items prop.