• Resolved Jon Dingman

    (@jdingman)


    I’ve disabled all but the 150×150 standard image for my content and CPTs. I’ve then added custom image sizes to be registered withing WordPress.

    However I’m finding that the data being stored in the Algolia index does not include these custom image sizes.

    Is there a way to extend this plugin to include custom image sizes?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I’m seeing this apply_filters( 'algolia_post_images_sizes', array( 'thumbnail' ) ); over in includes/class-algolia-utils.php for a get_post_images() method. Looks like that may be what you need here. It’ll iterate over wp_get_attachment_image_src and construct an array of image data for each size provided.

    Thread Starter Jon Dingman

    (@jdingman)

    Thanks Michael. Are you stating that the codebase should already be indexing all associates images, or I would need to write custom code to handle that?

    Thread Starter Jon Dingman

    (@jdingman)

    What you stated is accurate. It’s looping through a single thumbnail to get the image. If you want to push additional images to the index in Algolia, you need to add them.

    Solution URL: https://discourse.algolia.com/t/image-size-on-instantsearch-page/1593

    Actual solution:

    add_filter('algolia_post_images_sizes', function($sizes) {
        $sizes[] = 'medium'; 
    
        return $sizes;
    });
    • This reply was modified 4 years, 3 months ago by Jon Dingman.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    From the looks of the filter, unless the plugin is internally doing an add_filter() elsewhere for other sizes, it’s only handling thumbnail. So you’d want to add your own callback to include any other sizes you want for this.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Forgot to refresh, and saw that you found a solution.

    Let us know if you need anything else Jon

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Support for custom image sizes in Posts index’ is closed to new replies.