Tell us what you are trying to do?
Hello, i would like to filter [wpv-control-postmeta type="select" field="wpcf-track-name" default_label="Choose a track" url_param="wpv-wpcf-track-name"] to only show track names related to the parent "Trail" post.
I tried adding the relationship to the query filter but it still shows up in the dropdown options.
What is the link to your site?
hidden link
Hi there,
Would you please give context on your setup?
Kindly give me the way relationships are set up and what are the custom fields and how you want the select values filled so that I can grasp a better idea of the setup.
If you can provide a small implementation here it is even better so I can see the results:
hidden link
Thank you.
Implementation complete. If you check out this page: hidden link you will see the elevation section of the page. I would like the filter dropdown options to be limited to only the child tracks of the trail post. For example, on the Seguin trail page there should only be an option for "Forks of the Credit" because it is the only track in the field group for that trail.
The demo site has been setup with all of the custom fields as you requested above.
Thanks,
Cam
Hi Cam,
Thank you for the demo. I checked the details and I can not understand what is the common option between "Forks of the Credit" and "Seguin Trail - Horseshoe Lake Road to Orville".
Where did you set them to be a child or any kind of relashion? The issue is that I do not see any common thing between them other than they both are trails.
Thanks
Sorry I accidently put the forks of the credit track in the Seguin trail. It has been fixed.
There is no relationship between the seguin and forks of the credit trail.
Please let me know if this helps or if you need more information,
Cam
Hi Cam,
The issue that I have understanding your implementation is that I am not sure how you set a track post item to be the child of another one. I am confused on the implementation.
I see no connection between the post items that is why I am not sure why the search dropdown should not show a post item and should show another one.
Hey Again,
The Track is a repeatable group field within the trail post type, the relationship is that the trail post type is the parent of the track because the repeatable group is inside the trail post type. I want the dropdown to only show the repeatable group fields from the single trail post and not all of the trail posts.
I know this does work because I am able to put a query filter to only show repeatable groups from that trail, but for some reason the it does not apply to the dropdown and still shows all of the repeatable group fields for all trails and not the single trail post that you see on the frontend.
For Example,
The "Forks of the Credit Road" trail post only has one track, called "Forks of the Credit Fixed". When you go to the trail page ( hidden link ) the elevation dropdown should only show "Forks of the Credit Fixed". It is currently showing tracks from the other posts like "this track is from island lake, this track is from test 3, and this track is from test 4", and shouldn't be.
I hope I explained it better now.
Thanks,
Cam
Hi there,
Thank you for the info, I think I now understand the problem. I asked for a second opinion and will get back to you.
Thanks
Hi there,
I double-checked and the issue is that Toolset does not have such a filter per post when there is a repeatable field.
There is a workaround that I implemented in the clean installation which is just a workaround and is not a feature so whatever you see is as is and if you need further features you will need to ask for a feature request here:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
Now the workaround:
If you check here:
hidden link
I added a view, in that view, I just listed the track names for the current post that will show.
In the content template:
hidden link
I added the view after your view. My view adds the track names as an HTML hidden field in the page.
If you check the sidebar of the content temp[late I added the Javascript code below:
jQuery(document).ready(function() {
var theTracks = '<option value="" selected="selected">Choose a track</option>';
jQuery('#track-options > input').each(function(){
theTracks += '<option value="' + jQuery(this).attr('value') + '">' + jQuery(this).attr('value') + '</option>'
});
jQuery('select[name="wpv-wpcf-track-name"]').html(theTracks);
});
What it does, is to get the options from the hidden field and replace it with the default search select options of Toolset.
Now if you check the single post you will see the items show the relevant track names:
hidden link
I added another track to the trail post to make sure it works ok. (blabla)
Thanks.
Thanks Christopher, your fix works perfectly!