• Resolved wpdevhalo

    (@wpdevhalo)


    Firstly, thank you for the plugin. I’ve managed to index CPTs for now using the available documentation and I have a few questions to ask

    1.) How to add additional attributes that don’t belong to a Custom Post type. I’ll add the code of how I used to get it done using “WP search with Algolia” plugin.

    /* Algolia customisations */
    /* Indexing Grade */
    add_filter( 'algolia_post_shared_attributes', 'grade_post_attributes', 10, 2 );
    add_filter( 'algolia_searchable_post_shared_attributes', 'grade_post_attributes', 10, 2 );
    
    /**
     * @param array   $shared_attributes
     * @param WP_Post $post
     *
     * @return array
     */
    function grade_post_attributes( array $shared_attributes, WP_Post $post ) {	
    	if ( 'book-review' !== $post->post_type ) {
    		// We only want to add an attribute for the 'resource' post type.
    		// Here the post isn't a 'resource', so we return the attributes unaltered.
    		return $shared_attributes;
    	}
    	$shared_attributes['grade'] = get_post_meta( $post->ID, 'wpcf-book-grade', true );
    	// Always return the value we are filtering.
    	return $shared_attributes;
    }

    I want to know how to do it with this plugin.

    2. How do I add InstantSearch Widgets or use their API to add searchable filters etc to the widgets using additional parameters ?

    thanks

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Additional Documentation’ is closed to new replies.