Tell us what you are trying to do?
In the first site I designed with Toolset I had a CPT called girls and a taxonomy called this_week which had sub entries for Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday. Admins then selected a girl post to edit and ticked boxes for the days that girl would be working. Then using views I was able to produce a schedule page showing rows of girls in order of Monday through to Sunday. You can view this here:
hidden link
The only problem is that it takes ages for admins to produce this list as they have to go to 30 girl post pages and painfully tick boxes. Admin Columns Pro provided a better solution as this allowed bulk editing on the girl post list page but adding days to 30 or more girls is complicated. Adding girls to 7 days would be easy on one screen without scrolling. Like shown in the attached black background screenshot of photoshopped mockup
What I’d like to see is a page like this, which admins go to and click fields for each day that brings up a list of all the girls post titles that can be multi selected then I can use views to create something from this result. Could this idea be a CPT called Week with 7 custom fields (one for each day) and Week 1, by virtue of a relationship, shows the list of girl post titles to multi select from? Or is there another way to do this?
I am now designing a second site with toolset and I would like to improve upon the first site.
I tried creating a Week CPT and added one post ref field called Monday and selected many to many but after that something went wrong and the plugin page showed up as blank. I had to restore the site from a backup in the end. While adding the field I saw a message (shown in the white background screenshot attached) and didn’t understand what was meant by updating templates for schedules and girls? I don’t have any templates either so did I do something very wrong?
I’m scared to try anything else now so knowing what I want to achieve as shown in the dark background mock up in photoshop, would a CPT called week be the way to go or is there a better solution.
Many thanks,
Barry.
Is there any documentation that you are following?
No
Is there a similar example that we can see?
No
What is the link to your site?
hidden link
Hi Barry,
Thanks for asking! I'd be happy to help.
Since a bulk interface to connect multiple posts at once isn't available out-of-the-box, a similar solution will require some custom programming.
Although 1-1 customization assistance of this scale is beyond the scope of support that we can provide, I can point you in the right direction.
1. You can keep using "Weekdays" CPT for storing all 7 days as separate posts and "Girls" for storing each girl post.
2. Both these posts can be connected using a many-to-many post-relationship.
3. You can create a new post edit form to edit each "Weekday" and the form will have a "multiselect" type generic field.
( https://toolset.com/documentation/getting-started-with-toolset/publish-content-from-the-front-end/forms-for-editing/ )
4. That generic field will show all available "girls" as options through a custom shortcode. This way admin will have the option to edit each day of the week and select or unselect connected girls for that day.
5. Last and the challenging part would be to create a custom function that is attached to "cred_save_data" hook.
( ref: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data )
That function will get the IDs of the selected girls and will connect them to the weekday that is being edited using "toolset_connect_posts" function ( ref: https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_connect_posts )
Likewise, it will also need to disconnect any girls which were not selected, using the "toolset_disconnect_posts" function ( ref: https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_disconnect_posts ), in case they were previously connected.
Note: you'll find some example snippets for a custom shortcode for a generic field and a function attached to "cred_save_data" hook in this reply.
https://toolset.com/forums/topic/split-publishing-related-many-to-many-posts/#post-1215323
I hope this helps and for more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/
Note: the screen with white background in your screenshot is shown when you're using a post reference field and you try to use it as a repeating field. At that point the plugin tells you that in order to use that connection as repeating one, you'll need to update the relationship type to "many-to-many". That is perfectly normal and expected screen and behaviour.
regards,
Waqar
Hi Waqar,
Thank you so much for such a detailed reply. I honestly don't know how you know so much......but I'm glad you do. I will go through each paragraph very carefully.
Much appreciated,
Barry
You're very welcome Barry.
Please let me know if you have a question about any particular step.
regards,
Waqar
My issue is resolved now. Thank you!
Hi Waqar,
I'm sorry to trouble you but I'm stuck. I created a CPT called Schedule Days, then created post reference field called Girls Working Today. I can only select one girl through not many when I edit the first post I created called Monday. How may I set this field to allow me to multi select girls from the list? I looked at your link but it didn't seem to relate to what I'm doing. I'm attaching screenshots to show the details of the field I created and then also from the post I created in Schedule Days called Monday and tried adding girls for the first time.
Many thanks,
Barry.
Hi Waqar,
Even though I didn't understand the need for creating a form to edit things (I thought my post relationship field would be multi selectable), I'm just going through the motions of doing what your link tells me to so I created a form and I got to the stage that you create a view and using the loop wizard, add fields etc and after clicking add a field I am not given the option for Forms Editing like in the link you sent. Here's some screenshots of what I did but do I really need to create a form. Can I not somehow make the Girls Working Today field in the Schedule Days post not multi selectable?
Many thanks,
Barry.
Hi Waqar,
I think I'm making progress. I've started the thought process again and have removed the post reference custom field by deactivating the group. I then went to relationships and created a many to many between Girls And Schedule Days (one post in that CPT for each day). I was then able to easily connect girls to a schedule days post and schedule days to girls so that's absolutely perfect. Now I understand the need for a form to be able to do this neatly as so far, I've not really gained anything in ease of use for the client who will edit then schedule. So I'll read through your link again and another one I've found on Toolset to see if I can do this without bothering you.
Many thanks,
Barry.
HI Waqar,
My head is spinning. I've tried so many things with forms but nothing works for me. I managed to use an Admin Columns Pro Add-On for Toolset Types and have got the Schedule Days CPT post list to show the CPT Post Title and then in another column, the Post Relationship data which shows the girls connected. Perfect. Only I can't inline edit the list like I could a Taxonomy. No bother though. It shows administrators the day and the girls working for all 7 days on one page. Clicking a Day post then allows the administrator to connect or disconnect girls. I think this will do. Howcer I fear administrators may trash a girl from the list as easily as clicking the disconnect button. Is it possible to prevent 'edit' and 'trash' from showing? I'm showing 2 screenshots. One of the neat post list with the relationships, and another of the Days CPT editor page showing the trash icon.
Is this possible?
Many thanks,
Barry.
Hi Barry,
Thanks for sharing the update and glad you've found something simpler that should work.
There is no option available to disable the action controls (like "edit", "trash" etc) from the related posts, but you can use custom CSS to hide it.
( ref: hidden link )
For example:
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo '<style>
#toolset-page-content .types-related-content-table-wrapper .column-post-field .row-actions {
display: none !important;
}
</style>';
}
</code
Note: You can use Google's inspect element tool, to narrow down to the desired page elements, for styling through CSS code:
hidden link
regards,
Waqar
Hi Waqar,
I’m now on to something with Relationship Forms. Here's a link:
hidden link
Just to recap. I’ve created a many to many relationship between Girls and Schedule Days.
Connecting and disconnecting from within Schedule Days is fine but just not clear cut enough for administrators. It’s a bit of a clunky solution with a template feel and not customised enough for the the administrator’s needs.
I’m trying to rethink things through again.
I’ve created a Relationship Form that shows a drop down for Schedule Days and another for Girls with a submit button underneath.
For testing purposes, I’ve created two views that show all girls connected to firstly Monday and then Tuesday, the only two Schedule Day posts so far. So in theory from this page when finished, the administrator will see the two drop downs and seven rows with lists of each girl connected to the days. That’s all the info they want in a small space so it’s perfect.
Using the link above is basically what I want BUT, it looks a bit basic and the toolset option for Relationship Forms is not available in Elementor for some reason under the Toolset Forms option. Also, this method only allows me to add girls to days, CRUCIALLY not REMOVE them.
Am I getting very close to achieving what I want? Are you able to help me get something like this page working so that I can add and also remove girls from days and also find out why the Toolset Relationship option is not available from within editing from Elementor so I am forced to create the page with the WordPress Default editor?
I know I’m taking up a lot of your time but perhaps being able to edit two custom post types like this that need multi selected posts to be connected all at once could be very useful for other people?
Many thanks,
Barry.
Hi Barry,
As explained in my very first reply in this thread, to edit bulk post relationships on a single page, complex custom code will be involved.
But since you're already rethinking the entire approach, why not switch back to using taxonomy connection and dropping post-relationships? I understand that your original concern with using custom taxonomy for weekdays was that the website's admin will need to open and edit each girl's post, individually. But this can be avoided using a view and an edit form.
Here is the summary:
1. You'll remove the post Type for weekdays and its post-relationship with Girls and add a new custom taxonomy "Week Days" for Girls post type.
Important: please make sure to select taxonomy type to "Hierarchical".
( screenshot: hidden link )
2. Add all 7 weekdays as an individual term in this new taxonomy.
3. Next, create a new post edit form for Girls post type and set it to use AJAX for form submission.
( screenshot: hidden link )
4. In this form, you'll need only one field which will be to manage this new custom taxonomy and it can set to be of type "checkboxes" or "multiple selections", as you prefer.
( screenshot: hidden link )
5. As the last step, you can create a new view, which lists all Girls posts and then insert this new post edit form in that view's loop item.
( screenshot: hidden link )
This way, the admin will have all the information on a single page, which will also be editable.
Based on the available built-in Toolset features, this is the closest solution, which doesn't involve complex custom programming.
regards,
Waqar
Hi Waqar,
Thank you very much indeed yet again. I tried to close this ticket and add feedback but an error message appeared saying 'duplicate reply you may have said that already' etc. I tried it again saying something slightly different in the feedback field but I got the same message. Perhaps you can check the status at your end? Thank you so much for your help.
Many thanks,
Barry.
You're very welcome Barry.
I understand that you've added feedback to this ticket already once, which is why it is not allowing it again.
With your permission, I'm marking this ticket as resolved from my side.
For a new question/concern, please open a new ticket - we're here to help!
regards,
Waqar