Hello,
I still in the dev of my advocate site. The search function works great but my client want one more thing. After a search and after to look at the profile of an advocate, he wants to see one more time the advocates working in the same town.
So I make a view to display the result of the profile and in this view an another view with filtering by town by nothing shows up.
For info, the adress is repeater group and coordonnées is the parent of this repeater group
Here is the url lien caché
Hello. Thank you for contacting the Toolset support.
Do you mean that on the following singe page under the section "Some advocate in the same town", you wan to list the other posts that belong to the same town - Versailles?
=> lien caché
If this is correct, I need to first review your existing view, can you please share the screenshot of the edit view page that is displayed on the following page:
=> lien caché
You can also share the screenshot of the custom field group that holds the repeating field group.
Hi Minesh
Do you mean that on the following singe page under the section "Some advocate in the same town", you wan to list the other posts that belong to the same town - Versailles?
YES !
You find screenshot setting.
Ok - It's not clear with your screenshot the Repeating Field Group is attached to what post type?
However - what if you just duplicate the view you created and then with that duplicated view, just change the Query Filter and set the option "Shortcode Attribute" and add the shortcode attribute name for example city:
Hi Minesh
Ok I put your shortcode but that returns ALL the towns
what I mean it is in the single page if the advocate works in “Versailles” show me all the advocates working in “Versailles” only
Hoping that is clear with my poor english
Thanks for your support
It looks like there is something missing - I do not know why you are adding the post-relationship filter and add the shortcode attribute to city.
You need to add the custom filed filter in addition to post-relationship filter. If you do not know how to do it, please share access details and I will be happy to assist.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I checked and the thing is that you added the view as given under - outside the view loop.
<h1>Some advocate in the same town </h1>
[wpv-view name="avocat-same-ville" currentcity="[types field='ville'][/types]"]
The thing is that outside the view's loop [types field='ville'][/types] shortcode will not return anything as the field ville belongs to the repeating field group which may have multiple entries.
So, we need to filter the view with the field "barreau" - for example;
<h1>Some advocate in the same town </h1>
[wpv-view name="avocat-same-ville" currentcity="[types field='barreau'][/types]"]
Please check how the view's query filter is setup:
=> lien caché
Filtre de champ personnalisé Supprimer Modifier
Sélectionner les éléments avec le champ :
Ville est un chaîne comme VIEW_PARAM(currentcity)
And to ignore the same post and make sure it should not display again as you are already on that post, we need to use the conditional statement to check the current page ID and parent post ID.
The entry is repeating on the following page: lien caché
because, if you check in the backend, there are two repeating field entries:
=> lien caché
With the following URL: lien caché
- if you check the page in admin section, the field "Barreau" holds the value - Lille lien caché
And as I informed you in my previous reply, we are filtering the results using [types field='barreau'][/types].
As you can see - you want to display the related parent information, and the parent will be the same for all repeating field group entries, what we can do is, we can limit the result to 1 as all repeating field group item will have the same parent where you are displaying results: lien caché
if you accept this way, we can move the following view withing the view's loop for the following view:
=> lien caché
For example:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<div class="ville-container">
<ul class="wpv-loop js-wpv-loop ville-bloc">
<wpv-loop>
<li>[wpv-post-body view_template="element-de-boucle-dans-liste-des-villes-et-tromni"]</li>
</ul>
</div>
<h1>Some advocate in the same town </h1>
[wpv-view name="avocat-same-ville" currentcity="[types field='ville'][/types]"]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]Aucune coordonées disponibles[/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
As you can see we move the view within the view's loop and there we will have access to the ville field value.
You can try the above approach and I think that is suitable for you. You just need to copy/paste the above code within the following view's loop editor.
=> => lien caché
Hi Minesh,
Thanks it works ! Last question if I want to put a message if there's no town availalble, can I make a conditionnal statement on the view itself ?
Les nouveaux fils créés par Minesh et associés à celui-ci sont repris ci-dessous :
As per our support policy, we entertain only one question per ticket. This will help other users searching on the forum as well as help us to write correct problem resolution summery. You should resolve this ticket.