Skip Navigation

[Résolu] How to show similar posts through layout template?

This support ticket is created Il y a 4 années et 10 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Marqué : ,

This topic contains 10 réponses, has 2 voix.

Last updated by Minesh Il y a 4 années et 10 mois.

Assisted by: Minesh.

Auteur
Publications
#1262319

Hi,

I have a custom post type with custom fields city, country and few checkboxes and repeatable fields.

On the post landing page, I want to show others posts who have the same city or country (or values in custom fields).

How can I showcase the same?

Regards,
Lokesh

#1262325

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well, in that case, you should try to create a view filter by your custom field city and pass the current city value as the view's shortcode attribute - For example:

[wpv-view name="test-view" city="london"]

Then, Add the query filter to your view for the custom field and select filter by shortcode attribute "city":

More info:
=> https://toolset.com/documentation/user-guides/passing-arguments-to-views/#controlling-the-filter-with-shortcode-attributes
=> https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

#1263743

Thanks for the reply. I did the same and everything was working fine. I then changed the view name and slug (as I was doing a testing with a test name) and suddenly the view has stopped working i.e. no items found.

I then tried creating a new view but that is also not working. I enabled debug mode and the mysql query seems to be correct but the results found are zero.

Please help urgently on this.

#1263761

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

That is really strange.

Can you please share problem URL where you added the view as well as wp-admin access details.

*** 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.

#1263933

This is urgent. Please take on priority.

#1263961

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now: hidden link

The issue with both view was you selected wrong custom field for query filter and I've added the correct field and it looks OK now.

#1263965

Hi Minesh,

Thanks for the fix. However I dont understand, what exactly was wrong. As far as I remember, I had selected correct field 'Vendor Main City' and 'Vendor Main Country' in respective views filter.

Did you do anything else apart from changing the attribute name to vcity?

#1263969

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

no -when you try to add query filter - you will see the fields 'Vendor Main City' and 'Vendor Main Country' will appear two times within that query filter select box, and I chose another one which appears at bottom of the select box and it works and that's the correct field to add to query filter section.

#1263985

Got it. Now I remember that I selected field from 'Custom field' set while I think you selected from 'Field Group for Vendors' set.

What is the difference between the two set and when to use either of them?

#1263989

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - you should always select the field from the related custom field group within the select box.

#1265465

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

As your issue is resolved - Can you please close the ticket 🙂

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.