Skip Navigation

[Resuelto] views

Este es el foro de soporte técnico para Toolset: un paquete de plugines para el desarrollo de sitios WordPress sin escribir PHP.

Cualquier persona puede leerlo, pero solo los clientes de Toolset pueden publicar en este foro. El soporte de Toolset atiende 6 días a la semana, 19 horas por día.

Etiquetado: 

This topic contains 7 respuestas, has 2 mensajes.

Last updated by stefanor-4 hace 2 meses, 3 semanas.

Assigned support staff: Shane.

Autor
Mensajes
#2030071

Tell us what you are trying to do?
Hello, I'm trying to show in a view the restaurants/apartments close to a location, within a radius of xxx Km, with the query filter distance

Is there any documentation that you are following?
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<ul class="wpv-loop js-wpv-loop">
<wpv-loop>

  • [wpv-post-link]
  • </wpv-loop>

    <!-- wpv-loop-end -->
    [/wpv-items-found]
    [wpv-no-items-found]
    [wpml-string context="wpv-views"]No items found[/wpml-string]
    [/wpv-no-items-found]
    [wpv-layout-end]

    What is the link to your site?
    hidden link if you choose a different villa hidden link restaurants do not change

    Can you help ?
    KR
    Stefano

    #2030223

    Shane
    Supporter

    Languages: Inglés (English )

    Timezone: America/Jamaica (GMT-05:00)

    Hi Stefano,

    Thank you for getting in touch. I'm not sure I understand correctly.

    Is it that you want to show the posts that are related to the current one within xx km ?

    Or is it that you want to show the posts that are within xx km of the users current location?

    Please provide some clarity on this and we can take it from there.

    Thanks,
    Shane

    #2030261

    Is it that you want to show the posts that are related to the current one within xx km ?
    ------
    Hello Shane
    This is what I need.
    KR
    Stefano

    #2030281

    Shane
    Supporter

    Languages: Inglés (English )

    Timezone: America/Jamaica (GMT-05:00)

    Hi Stefano,

    Thank you for the clarification. Seeing that you are already using the Classic view editor follow the instructions below on order to achieve this:

    1. Go to your view at Toolset->Views and edit it.
    2. Scroll to the Query filter section and click Add a Filer.
    3. Add the filter for Distance.
    4. Under "Field to compare to" ensure that you've selected the correct field to compare to.
    5. Under Filter Radius set the distance that you desire.
    6. Select "Distance center is set using shortcode attribute: " the default is map center.

    Add your view to the template for you post in the format [wpv-view name='my-view-slug' mapcenter="[types field='address-field'][/types]"]

    Now you will replace "my-view-slug" with the actual slug of your view and [types field='address-field'][/types] with the correct shortcode to display the address of the current post.

    Once you've done this then you should be able display the posts within xx km of the current post.

    Please let me know if this helps.
    Thanks,
    Shane

    #2030333
    Screenshot (48).png

    Hello Shane
    It doesn't work for me, I've tried with both versions:
    Elementor > toolset view >list-of-restaurants

    An d with your code
    [wpv-view name='list-of-restaurants' mapcenter="[types field='address'][/types]"]

    Results are the same but when I change location nothing happen

    #2030995

    Shane
    Supporter

    Languages: Inglés (English )

    Timezone: America/Jamaica (GMT-05:00)

    Hi Stefanor,

    This should get it to work, would you mind allowing me to have access to the site so that I can take a look to see what is happening here ?

    I've enabled the private fields for your next response. Please also send an example page where I can see the view on the frontend.

    Thanks,
    Shane

    #2036943

    Shane
    Supporter

    Languages: Inglés (English )

    Timezone: America/Jamaica (GMT-05:00)

    Hi Stefanor,

    Thank you for the credentials.

    I logged in and had a look at the site. The problem was that you were using the wrong slug for the address field. The correct code is below.

    [wpv-view name='list-of-restaurants' mapcenter="[types field='address_details'][/types]"]
    

    This should now be working correctly.

    Please let me know if this helps.
    Thanks,
    Shane

    #2040933

    My issue is resolved now. Thank you Shane!