This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: index pdf contents of custom post type

Home Forums Product Support Forums Ajax Search Pro for WordPress Support index pdf contents of custom post type Reply To: index pdf contents of custom post type

#23475
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Thank you for the previous details, I will look into that plugin API, I already added it to the upcoming features list. It is a pretty decent plugin, I am sure they have an API I can use to get the downloads.

For changing the result URLs as well as image, a custom code should be used. There is this example, based on that, you could try something like this:

add_filter( 'asp_results', 'asp_custom_link_results', 1, 1 );
function asp_custom_link_results( $results ) {

  // Parse through each result item
  foreach ($results as $k=>&$r) {
    if ( isset($r->post_type) && $r->post_type == 'attachment' ) {
         // $r->id is the attachment ID, in case needed
         $r->link  = 'https://google.com'; // custom link
         $r->image = https://'myimage.com/image.jpeg';  // custom image url
    }
  }

  return $results;
}