Hi, this is going to be complicated to explain - I will try my best.
The page is a Blog for Book reviews. So I have 2 custom post types: "Book reviews" and "Book authors". They are linked by a M:N relationship.
Book reviews can have different states:
1: Book is on the shelf
2: "I am currently reading"
3: I finished reading but the book review was not created
4: review published
On one page I am showing all Book authors. But I want to filter them. I only want to show the book author if at least 1 book review is on state 4. Reason: The Book author name is linked. And the link goes to the Archiv of all Book reviews. I want to avoid "no results".
So I have created a view that shows all book review states for one book author. I have sorted the list (desc) and show only the top 1.
Now my question: how and where do I need to but the wpv-conditional to inhibit the showing.
Hello. Thank you for contacting the Toolset support.
As you shared its bit complicated based on the information you shared to understand. I understand that you want to display the filtered results for book authors where book reviews status is set to 4.
Can you please share problem URL and admin access details and share all information that on that link/post what book authors should be displayed.
*** 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.
I've modified the view "" now so that it will return the comma separated post IDs of post type "Rezensionen" posts where custom field "Buchstatus" is set to 4. I've also check mark the checkbox "Disable the wrapping DIV around the View " on the following view:
=> hidden link
Now, I've added the post relationship filter to the view "view_autoren_fuer_buchautorenanzeige ":
=> hidden link
Beiträge in einer Rezensionen Autoren-Beziehung auswählenthat are related to the Post with ID set by the shortcode attribute wpvrelatedto.
z. B. [wpv-view name="view-name" wpvrelatedto="123"]
And then I'm displaying the view as for the first tab as given under:
I have created the page for the View 3928 "view_autor_buchstatus": hidden link
to see what is the return. As you mentioned above. A comma separated list of all post-Ids with status=4. Without spaces.
Am I right that, that this is a kind of an array that is defined as a filter?
I have copied your statement to all tab sections. The book from "Obama" is still on status "1". Therefore as long as Obama is still in the list, the filter unfortunately does not work correctly - I am afraid.
sorry that din't work out, as the the example you were thankfully creating was creating a list of authors, but unfortunately unordered and with named doubled or tripled.
I was trying another approach. I would like to start with a view to the custom post type "Autoren" limited to the 2 arguments "from" "until" as before. Then I would like to set a [Condition] statement that uses a custom function as argument. I created the custom function "call view" for this. But unfortunately I capabilities for PHP coding are limited. Is there any snipped I could take as template?
As Minesh is currently on vacation at the moment I will be stepping in to handle this ticket for him.
From what I understand you want to display the Parent Post only if the Child post has the status of 4 correct?
Has any of the steps that Minesh provided produced the correct results or near correct results?
Please let me know so that I can pick up from where he left off.
. Then I would like to set a [Condition] statement that uses a custom function as argument. I created the custom function "call view" for this. But unfortunately I capabilities for PHP coding are limited. Is there any snipped I could take as template?
Can you send me the custom function and explain in a bit of detail what it should be doing.
Hi Shane, I must say I dont mind at all that you jump in!
Meanwhile I started learning a lot. I installed MAMP and VS Code on my PC. I duplicated my page to a localhost. So right now I am working myself into the Toolset Post relationship API. I managed to get the get_related_post function running.
My strategy is to check if the get_related_post function is not empty (So there is a post with state 4) and then I would lookup for the authors name and return this as string. So then I would not use the "condition with the custom function argument" solution anymore, but a short-code. It would be great if I could come back to you the moment I have put this together for verification or debugging. OK?
I created a customs PHP function inside the call-view.php and put it to the front end as shortcode.
Actually there are 3 issue, that are pretty easy for you to solve I guess.
* actually I am too stupid to hand over arguments through the shortcode. I am recieving a JSON-Error
* The result - if the argument handling would work - will not be shown inside of the Tabs-Block from where I am calling the shortcode. I have created a little test on the page "test". I wanna have several riders like "A|B|C" and "D|E|F", ... So how can I put my container inside the container of the Tabs-Block?
* I was failing to add a CHAR filter with the range a-c and so on to the WP_Query. So I created a little function and used str_starts_with - pretty much a work around? This one I dont mind too much as it would work.