[Résolu] cannot get view to filter to current post
This support ticket is created Il y a 6 années et 1 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.
I have created a Layout for the Product content type.
The product content type has a field for the product City, this field is also being used in the User account as a custom City field with the same select list content being used in the Products.
I have created a google map and display the products on the map. When the user clicks on one of the products on the map, on the popup box a custom message is displayed, the view checks to see if the City field of the Users account matches the Product city field being viewed on the map. It then displays a custom message depending on the result.
This works perfectly fine on the map.
However, on my Layouts page for products, I want to do the same. I am using the below code in another View, whcih i placed in the Layout page:
[wpv-post-title]<br />
[wpv-post-excerpt]<br />
[wpv-conditional if="( $(wpcf-product-state) eq '[types usermeta="user-state" user_current="true" output="raw"][/types]' )"]This Auction is hosted in [types field='product-state'][/types] and you can place a bid - <a href="[wpv-post-url]">BID NOW</a>[/wpv-conditional]
[wpv-conditional if="( $(wpcf-product-state) ne '[types usermeta="user-state" user_current="true" output="raw"][/types]' )"]This Auction is hosted in [types field='product-state'][/types] and you cannot place a bid[/wpv-conditional]
This doesnt seem to work on the Layout page and I cant get the view to filter the results to the current product being viewed (single page). It seems to be displaying ALL results
I wrote the login details here and then logged out and was still able to read the information so i deleted it as anyone can just access my site like this
I've Identified the issue and its that the custom fields that you are trying to display are not on the products.
Maybe i'm a bit confused but this shortcode also works on the layout.
[wpv-conditional if="( $(wpcf-product-state) eq '[types usermeta="user-state" user_current="true" output="raw"][/types]' )"]This Auction is hosted in [types field='product-state'][/types] and you can place a bid - <a href="[wpv-post-url]">BID NOW</a>[/wpv-conditional]
[wpv-conditional if="( $(wpcf-product-state) ne '[types usermeta="user-state" user_current="true" output="raw"][/types]' )"]This Auction is hosted in [types field='product-state'][/types] and you cannot place a bid[/wpv-conditional]
Could you let me know what exactly doesn't work.
Thanks,
Shane
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.