Tell us what you are trying to do? I have a view which should show results filtered by a relation ID. However, there could be several IDs. So I figured I could use a shortcode ("The post with ID set by the shortcode attribute") and return a string with several IDs.
Like "1,2,3". I try to use the Blocks attributes to do this (so using the UI). However the filter doesn't work. All posts are displayed.
Shouldn't this be possible or have I missed something?
Is there any documentation that you are following? I've checked this: https://toolset.com/course-lesson/displaying-related-posts/?utm_source=plugin&utm_medium=gui&utm_campaign=blocks
but it didn't answer my questoin.
Is there a similar example that we can see?
What is the link to your site?
Hi,
Thank you for contacting us and I'd be happy to assist.
On my test website, I was able to make this filtering work, using the following steps:
1. I created a new page and created a new view to show posts, with a post ID query filter, linked to the shortcode attribute.
( screenshot: hidden link )
2. Next, on the actual page where I wanted to show this view, I inserted the view block and selected the view from the step 1, as the existing view.
3. In this view block's settings, I entered the comma-separated list of target post IDs and it worked.
( screenshot: hidden link )
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
I created a new page & view. Same result. I think what's important here is that I try to filter the result with IDs from a RELATIONSHIP. So it's not just a matter of postIDs for the current posts in the view but instead for it's relationship (see included image).
When I try to set each relationship separately (with the "Specific" choice) it works. But when I try to combine two comma separated IDs (returned correctly by the shortcode) it just ignores the filtering altogether.
I can give access to the site if necessary (not to public).
Hi, I found this post: https://toolset.com/forums/topic/passing-multiple-arguments-to-views/
Seems it's not possible using the UI for several IDs but could be done with some custom code?
There's a hidden link to an example in the linked article I can't see.
Hi, I managed to solve this problem using by using wpv_filter_query. It's fine to use code for more complex filtering but it would be nice to connect this code to the view on the page somehow (to keep track of what code is affecting the current view).
And I would suggest (hope) you add the ability to have a shortcode which returns multiple IDs in the blocks view query filter UI as well. It's seems natural do have it there and don't have to mix code and the UI blocks (and I'm not the only one wanting this).
Hi, I managed to solve this problem using by using wpv_filter_query. It's fine to use code for more complex filtering but it would be nice to connect this code to the view on the page somehow (to keep track of what code is affecting the current view).
And I would suggest (hope) you add the ability to have a shortcode which returns multiple IDs in the blocks view query filter UI as well. It's seems natural do have it there and don't have to mix code and the UI blocks (and I'm not the only one wanting this).
Hi, I managed to solve this problem using by using wpv_filter_query. It's fine to use code for more complex filtering but it would be nice to connect this code to the view on the page somehow (to keep track of what code is affecting the current view).
And I would suggest (hope) you add the ability to have a shortcode which returns multiple IDs in the blocks view query filter UI as well. It's seems natural do have it there and don't have to mix code and the UI blocks (and I'm not the only one wanting this).