Tell us what you are trying to do? I have a number of custom post types. Some are alredy in the database some can be added. These custom posts types have parrent and children posts as well. I also have a form to sumbit new custom post type. After the data about the custom post is submited I display the post and am able to link it to parents and children. But what if I just want to display the posts that are in the database alredy. I don't want the user to see the fields for linking to parents and children posts just the posts.
Also if a user wants to edit one of the old posts where he would change the data in the posts and changes the linking to the parens and children will that need another form for editing the post and changing the links?
Not sure how to do that? Can you please suggest a method or send me to a document!
Is there any documentation that you are following?
But what if I just want to display the posts that are in the database already. I don't want the user to see the fields for linking to parents and children posts just the posts.
Are you referring to when the posts are being created you don't want them to see the fields for linking the parent/child? Are you referring to the Post Form ?
Also is it that you want this field to be hidden based on the user's role?
Also if a user wants to edit one of the old posts where he would change the data in the posts and changes the linking to the parens and children will that need another form for editing the post and changing the links?
The parent field can be added to the post edit form if not already there. You can have conditionals on the form based on the users role etc, however i need some clarity in order to provide the best guidance.
Say I have a group of custom posts type DOG, they have 10 posts dog0, ....., dog 9. And I have onother 7 custom posts type OWNER: owner0, ...., owner6. Now lets say I want to add one more post dog10. I have a FORM for DOG posts to enter all the DOG fields. I then submit the FORM DOG that saves dog10 and then displays the post dog10 using the display template. Bun now I want to link dog10 to owner6. For that I have made a RELATIONSHIP FORM. I place that RELATIONSHIP FORM on the display template so that after dog10 is sumbitted and is displayed I can now link dog10 to owner3 then submit. All that is fine and works.
Now I want to look at all the dogs that are in the database. So I display say dog5 but because the RELATIONSHIP FORM is inbeded in the display template when dog5 is dipslyed it will also have that relationship form. I don’t want that to be displayed if I’m just viewing all the dog data already in the database.
Now say I have looked at dog3 and noticed that the information isn’t correct. So now I want to have the ability to correct that information. Like say the dog3 had his name entered incorrectly or dog7 had the wrong owner linked.
So what I need is a way of entering new dogs and linking them to owners already in the database. I have that.
I also want a way to display the data on all the dogs in the database without additional forms.
I also want to have a way of correcting data already in the database.
I want it all done from the fronted of course.
I don'r care about the user roles yet. I’ll deal with that later.
I don'r care about the user roles yet. I’ll deal with that later.
User roles are important here because unless there is another you want to define when the form shows up. Currently I see 2 ways. You can allow only admins to view the relationship form and the edit form.
Or you can do it based on who is the author of the dog post.
Once I know which way you want to proceed then I can advise you on how to get it done. But there must be a condition for which the form is hidden/visible.
That would make the page far too busy. I have found another possible solution in W3Shool. I have placed custom HTML code on the Content Template
<button id="myHide">Hide</button>
<button id="myShow">Show</button>
and added <div class="form-group myTag"> to the relationship form then added a JS
jQuery(document).ready(function($){
$("#myHide").click(function(){
$(".myTag").hide();
});
$("#myShow").click(function(){
$(".myTag").show();
});
});
so now I can specify the users who can see the Hide and Show buttons as well as the defults. Not yet completelly worked out the details but that's how I prefere otherwise the pages will become too busy.
Happy to see that you were able to arrive at a solution.
so now I can specify the users who can see the Hide and Show buttons as well as the defults.
I would love to know how you want the buttons to be hidden to the users, will it be by their roles or by their ID's ? I would advise doing it by Role or by the Author of the post.
If you have any idea you're thinking of please let me know.
Thanks,
Shane