Skip Navigation

[Resolved] cannot set content to owner handler

This support ticket is created 5 years, 11 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 15 replies, has 2 voices.

Last updated by martinP-13 5 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1193035

when i go here (a duplicated view) hidden link
there is no option to select in the content owner<----> dog . i want show results for all dogs that are connected to an owner
.i was going to set this view as the parent with owner dogs Intermediary Posts to show the dogs related to the owner . then make the child view showing the related info to the dog.

this is correct process waqar? but im stumling at the 1st hurdle this time . i was going to delete the dog<---> owner relationship and start again but if i do that i will lose info in other views and thats a problem it will take me a week to get that info to show again 🙂

#1193167

so on a single owner page like here hidden link
i need to add under historical trial results BUT only for the dogs that are owned by TEST OWNER

Trial : placement test trial 3 ignore
Guns Choice : Gemma
Springer Spaniel Dog 20/08/15
Sire : post type sire test
Dam : post type dam test
Owner : TEST OWNER
Handler : test handler
Breeder : TEST BREEDER 1

what would the parent view be? owner<---> dogs?
in the child what would the relationship be set in content?

thank ive 5 types to set like this (breeder,owner,handler,sire and dams) then apart from some css im done thank god!!

#1193179
options.png

there is no option to select in the content owner<----> dog . i want show results for all dogs that are connected to an owner
The intermediary post type was hidden, but I have I edited the intermediary post type and made two adjustments:
hidden link
In the Options area of the editor, I checked "publicly_queryable" and "show_ui". See attachment options.png. You should now be able to find this post type in a View's Content Selection editor. Don't delete this relationship just yet, I think you can make it work now. Your logic sounds correct, there was just a configuration missing.

i need to add under historical trial results BUT only for the dogs that are owned by TEST OWNER
Okay you have a relationship between Events <-> Dogs, but no relationship between Events <-> Owners. So this one is tricky, because there's no direct relationship to establish a list of Events where this Owner has participating Dogs. First, you'll need to get a list of Dog IDs associated with the current Owner, then use those IDs to query Events <-> Dogs to produce a list of Events.
- Create a new View, called "view to show dog ids for an owner" and choose "Full custom display" in the new View popup window.
- In the Content Selection, choose "Owners Dogs Intermediary Posts".
- Add a Post Relationship Query Filter and choose the Owner Dogs M2M relationship. Set it up so that the parent post is "The post where this View is shown"
- Scroll down to the Loop Output editor and click "Loop Wizard". Select the option "List with separators" and click "Next". Insert the Post title field, then click "Finish".
- Highlight the Post title field in the loop editor and delete it. Click "Fields and Views" to insert the Post ID shortcode instead. In the popup, choose "A post related to the current post, set by a Types relationship", and select "Dogs" in the "Owners Dogs many-to-many relationship" section. This will output the Post ID of the Dog. Insert the shortcode.
- Below the Loop Output editor, check the checkbox that says "Disable the wrapping DIV around the View"
- Save the View and place it in the Owner template. You should see a comma-separated list of Dog IDs appear in the Owner template. Let me know if you're able to get this working, or if you get stuck. We'll move on to creating the list of Events next.

#1193243

thanks christian , i was with you upto here:

Scroll down to the Loop Output editor and click "Loop Wizard". this is fine

Select the option "List with separators" and click "Next". ok here too

Insert the Post title field, then click "Finish". ok here too

- Highlight the Post title field in the loop editor and delete it. i presume you meant [wpv-post-title]

Click "Fields and Views" the one directly to the right of loop editor?

to insert the Post ID short code instead. i only see post id , no Post ID (i think i get this,it will enter the post id shortcode in the loopwhere we deleted?)

In the popup, choose "A post related to the current post, set by a Types relationship", and select "Dogs" in the "Owners Dogs many-to-many relationship" section. This will output the Post ID of the Dog. ok here too

Insert the shortcode. ? where ??

- Below the Loop Output editor, check the checkbox that says "Disable the wrapping DIV around the View" ok here

- Save the View and place it in the Owner template. which owner template? my single-owner.php like this
<?php echo do_shortcode( '[wpv-post-id item="@owner-dog.child"]' ); ?> or in the owner view template somehow? this bit is the most confusing

You should see a comma-separated list of Dog IDs appear in the Owner template. again which template?

Let me know if you're able to get this working, or if you get stuck. We'll move on to creating the list of Events next.
NO its not working.....

many many thanks christian

#1193274

wouldi just be easier to set up a relationship with events and owner? as i really need to get these 5 pages complete by end of day

#1193313

- Highlight the Post title field in the loop editor and delete it. i presume you meant [wpv-post-title]
That's correct.

Click "Fields and Views" the one directly to the right of loop editor?
It's usually just above the loop editor.

to insert the Post ID short code instead. i only see post id , no Post ID (i think i get this,it will enter the post id shortcode in the loopwhere we deleted?)
Huh? Let's not nitpick the capitalization. The shortcode to display the post ID is wpv-post-id. Please insert it manually by typing it or by using the Fields and Views button directly above the loop editor.

Insert the shortcode. ? where ??
Where I told you to delete the post title shortcode.

- Save the View and place it in the Owner template. which owner template?
Do you have a Content Template assigned to the single Owner post type? If so, place it there. If not, your PHP template. Do not use do_shortcode to render a View in PHP. Use the render_view API:
https://toolset.com/documentation/programmer-reference/views-api/#render_view

wouldi just be easier to set up a relationship with events and owner? as i really need to get these 5 pages complete by end of day
I would keep going with what you have already unless you have time to rethink your site's entire data structure right now. Do you?

#1193319

no time to redo data !!

- Highlight the Post title field in the loop editor and delete it. i presume you meant [wpv-post-title]
That's correct. which one theres 2 ??

<wpv-loop>
[wpv-item index=other]
[wpv-post-title],
[wpv-item index=last]
[wpv-post-title]
</wpv-loop>

#1193332

3 things
1 i guessed at the 2nd [wpv-post-title],

2 to insert the Post ID short code instead. i only see post id , no Post ID (i think i get this,it will enter the post id shortcode in the loopwhere we deleted?)
Huh? Let's not nitpick the capitalization. The shortcode to display the post ID is wpv-post-id. Please insert it manually by typing it or by using the Fields and Views button directly above the loop editor.

sorry i missed out the word shortcode it should of read"to insert the Post ID short code instead. i only see post id , no Post ID shortcode" i wouldnt be so ill mannered to bite the hand that feeds me!!

3 hidden link i presume that is correct!!

#1193346

1 i guessed at the 2nd [wpv-post-title],
Replace both of them. I've done this for you. Now you need to create a list of Event IDs, like you created a list of Dog IDs. You'll pass that list of IDs into a View of Events, to produce a list of Events posts.

To create the list of Event IDs, you'll need to create another View of Event - Dog Intermediary posts. Instead of the parent post set by the page where this View is shown, this time you'll use a shortcode attribute to set the parent Dog. Inside that shortcode attribute, you'll insert the comma-separated list of Dog IDs you produced by the Dog IDs View. Now the filter will return all Events related to these Dogs. This is called passing arguments into Views: https://toolset.com/documentation/user-guides/passing-arguments-to-views/

In PHP, you can get the results of a View using the get_view_query_results API:
https://toolset.com/documentation/programmer-reference/views-api/#get_view_query_results

So you'll create your intermediary View described above and call get_view_query_results or render_view to get the list of relevant Event IDs in PHP. Then you'll create a View of Events, filtered by post ID, where the post ID is set by a shortcode attribute. You'll pass your Event IDs list into that shortcode attribute (or in PHP, pass it into the $args array used in render_view or get_view_query_results). In the loop of that View, you'll place information from each Event.

#1193372

i will have a proper read shortly but from a basic read through i feel this is well out of my scope!!
thanks as always

#1193391

thanks christian for your kind support, having reviewed this i feel that to continue with toolset in not a viable option for me,it is well out of my skill set and a far cry from its advertisment of no coding skills required,one again thanks for your time its much appreciated, could you point me in the direction of your refund procedure please

#1193459

this time you'll use a shortcode attribute to set the parent Dog. Inside that shortcode attribute, you'll insert the comma-separated list of Dog IDs you produced by the Dog IDs View.

there would of initialy have been 2-3000 dogs entered and roughly 100 more each week, if i read that correct i would need to type many 1000's of dog id's into a shortcode? is this correct?

#1193789

could you point me in the direction of your refund procedure please
You may initiate the refund process from this page https://toolset.com/buy/refund-policy/

if i read that correct i would need to type many 1000's of dog id's into a shortcode? is this correct?
Not correct. The point of creating these Views of Dog IDs and Event IDs is that the comma-separated lists are produced automatically, without the need for manual intervention, once you get them set up. Instead of typing the dog IDs manually, you type the View shortcode once.

#1193836

ah that makes sense!! and also sounds good, my biggest problem christian is as much i would want to do this i honestly believe its out of my skillset and would take me a week of back and forth to begin to get anywhere, the rest is done and im very happy with it , but half a job i a waste of time. thanks

#1193895

I understand your concern, and I'm not clear how you would like to proceed from here. An interconnected system of relationships and Views are required to relate and display your site's content like you want. There are limitations to what you can do with the shortcode interface, compounded by the use of PHP templates instead of Toolset Content Templates to display single posts. Our support staff can continue to offer assistance here in the forums, and I can provide you with a link to our contractors portal where you have the opportunity to connect with independent contractors: https://toolset.com/contractors
Hopefully this will help you make a decision about how to move forward.