I found a way but I don’t like it because. I have to manually code the mapping between a pod type and the template I want to display. I already have done this in the Auto Template Options configuration.
function the_content_for_type( $content ) {
return pods('dog', get_the_id())->template('dog');
}
add_filter( 'the_content', 'the_content_for_type');
And that mapping between post-type to Pods Template is exactly why we can’t do it automatically in Search and why we also can’t do that with Taxonomy Archives. Pods Templates aren’t ‘advanced’ enough to be specifically defined by post-type so we do not support doing the ‘auto mapping’ that is necessary to do this in Search or Taxonomy Archives.
This solution is not supported in any other way than through PHP, sorry.
Thanks for your reply.
I managed to do something a little bit more generic based on pod and template name.
So I have to name my template podName-archive and the template is applied in search too.
function force_pods_the_content_archive( $content ) {
if (is_search() && is_pod()) {
return pods(get_post_type(), get_the_id())->template(get_post_type() . '-archive');
}
return $content;
}
add_filter( 'the_content', 'force_pods_the_content_archive');