I have a template where I would like to pass a search parameter to a craft.entries.section in an included template. The current main template has this:
{% include "_includes/testimonial" with
{ type: "agency" }
%}
Then in the include I have this code where entry.clientsOrAgency is a dropdown field and I want it to only show results of the "type" passed in the parent template.
{# get one random testimonial entry #}
{% set testimonial = craft.entries.section('testimonials').search(entry.clientsOrAgency,type).order('RAND()').limit(1) %}
{% for quotes in testimonial %}
<div class="testimonial">
{# matrix field is 'testimonial' - find different quote types #}
{% for quote in quotes.testimonial %}
more code here
{% endfor %} {# quotes.testimonial #}
</div><!--testimonial-->
{% endfor %}{# quote in testimonial #}
The above code results in a template error Undefined index: query
Not sure how to resolve this.