You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 9, 2019. It is now read-only.
My post type, People, is heavily driven by the featured image. When indexing post objects without a featured image, my front end view is thrown off. There is a row of 4-5 objects and 1 doesn't have an image. Looks bad. I created a Customizer option that holds the default headshot image ID that I would like to use when a featured image is not present.
Under Aglolia Utils, line 94 could have a filter that defaults to the thumbnail ID but allow me to pass another ID for Algolia to index.
/**
* When a featured image is not present, use another attachment ID provided by database option
*
* @param int $id Post thumbnail ID.
* @param int $post_id Post ID.
*
* @return int
*/
function prefix_fallback_for_post_thumbnail_id( $id, $post_id ) {
if ( ! has_post_thumbnail( $post_id ) ) {
$id = intval( get_option( 'default-headshot' ) );
} else {
$id = get_post_thumbnail_id( (int) $post_id );
}
return $id;
}`
Is it possible to add this filter?
The text was updated successfully, but these errors were encountered:
What did you expect to happen?
My post type, People, is heavily driven by the featured image. When indexing post objects without a featured image, my front end view is thrown off. There is a row of 4-5 objects and 1 doesn't have an image. Looks bad. I created a Customizer option that holds the default headshot image ID that I would like to use when a featured image is not present.
Under Aglolia Utils, line 94 could have a filter that defaults to the thumbnail ID but allow me to pass another ID for Algolia to index.
$post_thumbnail_id = apply_filters( 'algolia_post_thumbnail_id', get_post_thumbnail_id( (int) $post_id ), $post_id );
Then my filter would look like this.
The text was updated successfully, but these errors were encountered: