Display custom indexed attribute in Frontend
-
Hello altogether
I’m building a custom search results page. To improve this, I indexed custom attributes at algolia. These are sent to the index with functions in the functions.php file. Since I need them for each post / page, they are also indexed at $shared_attributes.
So for examplefunction featured_image( array $shared_attributes, WP_Post $post ) { if (!empty(get_the_post_thumbnail_url( $post->ID, 'full' ))) { $shared_attributes[ 'fullsize_img' ] = get_the_post_thumbnail_url( $post->ID, 'full' ); } return $shared_attributes; } add_filter( 'algolia_post_shared_attributes', 'featured_image', 10, 2 );
If I login to algolia.com and take a look at the index, I can see that the attribute (fullsize_img) has been indexed.
Next step (and that’s where my problem comes in):
I want to display the attribute in my instantsearch.php, so on my search results page. I thought I can just get it with {{attribute-name}} (so the example would be: {{ fullsize_img }} ) like any default attribute. This doesn’t seem to work.
Did I forget something?
Do I have to set something up to be able to display the value on the front end?Thank you in advance and have a nice day
Reti
- The topic ‘Display custom indexed attribute in Frontend’ is closed to new replies.