1

I am getting a Twig runtime error on the below. The map and everything else works when I remove myFieldHandle(params).orderBy('distance').

Error:

Calling unknown method: craft\elements\db\EntryQuery::myFieldHandle()

Code:

{% set target = '90210' %}
{% set params = {
    target: target,
    range: 100
} %}

{% set entries = craft.entries.section('contractors').myFieldHandle(params).orderBy('distance') %}

{% set options = {
    height: 700,
    draggable: false,
    markerInfo: '_includes/mapInfoBubble',
    infoWindowOptions: {
        maxWidth: 250
    }
} %}

1 Answer 1

1

The example of myFieldHandle is just a placeholder for your actual field handle.

So if your Address field has a handle of address, it would look something like this...

{% set entries = craft.entries.section('contractors').address(params).orderBy('distance') %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.