Tell us what you are trying to do?
I have 2 CPT's with no official parent-child relationship.
Think of them as persons and videos. The Videos CPT has fields for persons involved in the video and we put those into individual single line fields where the numberic post id from the person CPT goes into.
We have a layout where we can display any information about the Person CPT. We now want to add a cell in the layout where we can call in any videos that have the "person-involved-field" match the current Person CPT post id.
I've tried a few different ways, but I can't make the postid match to the person-involved-field. I saw your documentation and it seems the only way I can do this is by calling the person-involved-id as a url paramerter, but I don't want to use that.
Is there a way to create a view or search query based on the variable... set in a custom field in another custom post type?
Basically in a a layout where I show mostly fields set for that specific custom post type, I'd like to do some sort of additional loop like this:
display any video cpt where the person-involved field matches the current post id.
Is there any documentation that you are following?
I have tried to follow your documentation on filtering and querying but can't quite figure this out.
Is there a similar example that we can see?
I don't know...
What is the link to your site?
* It's behind a maintenance plugin, but I can unlock whatever you need to look at it.
Hello. Thank you for contacting the Toolset support.
Well - As you said, you would not like to pass the post ID as URL param, what if you pass the post ID as view's shortcode attribute instead and filter your view by shortcode attribute.
For example:
[wpv-view name="view-name" postid="999"]
Where:
- postid is a view's shortcode attribute that contains the value of your desired post id. I set it static for now to 999 - you can change it as per your need.
And set your view to filter to filter by shortcode attribute.
Hi Minesh, I re-reviewed your suggestion and re-read the documents. I had seen them before and I tried following them. I'm going to try them again... but are you saying that I can use the variable/shortcode/slug of the postid field instead of your 999 constant? -- I thought I tried that and it didn't work. but I'll try it again.
Yes, I probably will need more help. This is what I've done so far...
1 - created a basic "videos" view.
2 - went in to add a new cell to my single-view-layout for "persons"
2a. the cell calls for the view I created in step 1.
2b. I went to filter and I'm stuck there.
What exactly goes into the shortcode attribute? The "shortcode" for the post-id field? or the slug? -- I need that value to be dynamic based on the single-view-layout, or rather when it gets called. I can't use the slug, or the post-field shortcode...
Referring to above example, please let me know which field value you want to replace with 999 value and please share problem URL where you added the view and view name.
*** 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 would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.
Additionally, I know its how-to question not a troubleshooting one but we send such message so you know that we may make changes to your setup. Its just for keep you notified ?
I have make amendments according to your requirement. what I've done is added the view to your layout using Visual Editor cell as given under:
And you're right, I didn't understand. It's still a little fuzzy, but I see what you did.
So a follow-up question. "pid" as you used it in the shortcode attribute, that's an arbitrary thing you came up with right? I mean the value there could have been "anything" as long as I call it as the filter later on correct?
But yes, this is working exactly as I wanted it. And I can use this for other scenarios. Thank you.
I know the standard disclaimer, but I wanted to give you my disclaimer. Obviously, you know what you're doing, but I've had other cases with other companies where the tech support isn't as knowledgeable and careful as you are.
So a follow-up question. "pid" as you used it in the shortcode attribute, that's an arbitrary thing you came up with right? I mean the value there could have been "anything" as long as I call it as the filter later on correct?
==> "pid" is shortcode attribute name - yes, you can give it as "postid" or "customfieldvalue" anything but you need to make sure the same name should be used when you add Query filter as it displayed in this screenshot:
=> hidden link
Thanks for your feedback. You are free to share your feedback. Have a great weekend.