To use the Hook add it to your Toolset Custom code section in Toolset -> Settings -> Custom Code and add it. Ensure that it has been activated.
Now what you need to do is to change the 4187 to the ID of your view and change "wpcf-parent-model-name-custom-field" to the slug of the custom field that you want to get the value for on the current page keeping the wpcf- prefix.
Next replace the second instance of wpcf-parent-model-name-custom-field to the field slug that you want to check for on the post type that the view is listing. In this user's case both fields were on the post being queried.
This support ticket is created 3 years, 8 months ago. 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.
Tell us what you are trying to do?
i want to have a list (view) of posts related to the post being currently viewed, linked by a shared value within a custom field
Is there any documentation that you are following? only what i have found on your website
Is there a similar example that we can see? not sure
I am using the classic view editor, and i have the view being displayed within an oxygen template for the custom post type, 'equipment-models'. The reason for the shared custom field is that some of the 'equipment models' are just variations of the same model and I want to be able to group them as 'siblings' or 'child' of a 'parent' model.
I have also created a Taxonomy called 'equipment-model-parent-taxon' as a means of grouping the 'siblings' or 'child' of a 'parent' model which does work, but wondered if this was also possible by shared custom field?
In the end there may be 1000's of equipment models and I am using spreadsheets to compile data and then upload using wpallimport with the toolset addon.
The site is password protected so i will share log in details with you if you want to have a look around. It is only a production site while I try and work this out.
Yes sharing the credentials will be really helpful.
However yes you are able to filter the view by the current post's custom field value. What you need to do is to add a query filter to your view and then set the query filter to get the value from a shortcode attribute.
Then you will be able to filter the view by passing the shortcode directly into the view like this.
Yes that is correct the Oxygen builder doesn't play nicely with the nested shortcode and not much we can do about that.
However there is an alternative, you can use the view filter hook to filter it automatically . Add the following to your custom code section in Toolset ->Settings -> Custom code and activate.
I tried as you suggested, but this is what was outputted on the front end - please note that i had created a new view and changed the view id in your code that you kindly provided.