Skip Navigation

[Resolved] Why need the content template for custom post?

This support ticket is created 3 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
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

Tagged: 

This topic contains 9 replies, has 2 voices.

Last updated by kelvinL-2 3 years, 11 months ago.

Assisted by: Jamal.

Author
Posts
#1994193
Screenshot 2021-03-20 at 4.00.03 PM.png

Dear Sir/Madam,

I have a custom post Application (parent) and Applicant (Child), I do have a content template for Applicant to show the Application and Applicant together.

[wpv-post-body view_template="None"]
[wpv-post-body view_template="application" ited="@application-applicants.parent]

If want to insert the edit post link after the delete post link to the Applicant View but got problem, it asks me to create content template

		<wpv-loop>
          <div class="row">
              <div class="col-md-2">[types field='applicant-full-name'][/types]</div>
              <div class="col-md-1">[types field='applicant-gender'][/types]</div>
              <div class="col-md-2">[types field='applicant-bod' style='text' format='F-J-Y'][/types]</div>
              <div class="col-md-2">[types field='applicant-hkid'][/types]</div>
              <div class="col-md-2">[types field='applicant-passport-number'][/types]</div>
              <div class="col-md-2">[types field='applicant-type'][/types]</div>
              <div class="col-md-1">[cred-delete-post action='trash' onsuccess='self']DEL[icon name="trash-alt"][/cred-delete-post]</div>
          </div>          
		</wpv-loop>

As my understanding, one custom post can only have one content template, what is the requirement to the screenshot?

#1994457

Hello and thank you for contacting the Toolset support.

Indeed, a custom post type can only have one content template ASSIGNED to it. But, you can still create unassigned content templates and use them if different parts of the website. Let's say, you have a custom field group with an address field that you want to use for different post types. Then you want to create a design that will output a map with a marker on it. You can build an unassigned content template and put the map inside of it. Then you can use this content template inside the assigned content template of each custom post type. You can use this unassigned content template inside a view too or inside an archive template. Does it make sense?

Regarding the edit link, you will need to create an unassigned content template and put the edit form inside of it. Then get back to this view and insert the edit link, it will let you choose the content template that you have used for it. The generated link for the edit form will follow this pattern: hidden link{id of the content template}.
This way Toolset will know that you want to edit the post instead of displaying its single page.
Check this article https://toolset.com/course-lesson/front-end-forms-for-editing-content/

There is a typo here, it should be "item" instead of "ited":

[wpv-post-body view_template="application" item="@application-applicants.parent]

I hope this helps. Let me know if you have any questions.

#1995019

Dear Jamal,

Do you mean I have to create the Templates for this View section in the View and then put the existing code between the <wpv-loop> ...</wpv-loop> to the Templates for this View?

  <div class="row">
      <div class="col-md-2">[types field='applicant-full-name'][/types]</div>
      <div class="col-md-1">[types field='applicant-gender'][/types]</div>
      <div class="col-md-2">[types field='applicant-bod' style='text' format='F-J-Y'][/types]</div>
      <div class="col-md-2">[types field='applicant-hkid'][/types]</div>
      <div class="col-md-2">[types field='applicant-passport-number'][/types]</div>
      <div class="col-md-2">[types field='applicant-type'][/types]</div>
      <div class="col-md-1">[cred-delete-post action='trash' onsuccess='self']DEL[icon name="trash-alt"][/cred-delete-post]</div>
  </div>          

I didn't use Templates for this View when I create the View, how can I recreate it like

<wpv-loop>
    [wpv-post-body view_template="loop-item-in-tour-directory"]
</wpv-loop>

Please advise the step or I need to create another new View

#1995133

No. You don't need to touch the view at this point. First, you need to create a new content template, from Toolset->Content Templates. Add the form inside of this template and save it. Then, return back to the view and add the edit link again. As you will already have the form inside of a content template, the Toolset user interface will let you choose it.

You may want to let me login to your website and prepare an example for you. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#1995285

Now that you have created the content template you can add the edit link to your view without issues. Can you tell me what view you are working on?

Regarding this shortcode:

[wpv-post-body view_template="application" item="@application-applicants.parent]

I can't tell where you place it if I don't know why would you use it. The shortcode will display the parent post(in the application-applicants relationship) using the content template "application".

$form_data['id'] correspond to the form ID as you can see in the URL of the form. Check this screenshot hidden link

#1995471
Screenshot 2021-03-22 at 8.31.53 AM.png
Screenshot 2021-03-22 at 8.32.14 AM.png
Screenshot 2021-03-22 at 8.06.31 AM.png

Dear Jamal,

I can do the redirect now. Thank you.

I log in as a subscriber, I visit my applicant list View, I can't see the delete and edit link, I check with the access control, the subscriber can delete own and edit own applicant post, what did I miss the configuration?

You can visit /my-applications/ with a different roles.

Best regards,

Kelvin.

New threads created by Jamal and linked to this one are listed below:

https://toolset.com/forums/topic/subscriber-unable-to-edit-own-posts/

#1995821

Hello Kelvin, I am glad I could be of help.

However, for support rules, we are able to handle only one issue at a time. This helps us to bring you a better service and also helps other users to find all the information here exposed. For that reason, I have created a new ticket to answer your last question. I'll be posting my replies there.

#2002893
Screenshot 2021-03-27 at 11.21.05 PM.png

Dear Jamal,

Don't know why I can't reply to thread https://toolset.com/forums/topic/subscriber-unable-to-edit-own-posts/ even I logged in.

Thanks for your help, I only set the privilege to Toolset > Access Control > Post Types but didn't set the Toolset Forms. Now the issue is solved.

#2002915

I have replied to your last question on that thread https://toolset.com/forums/topic/subscriber-unable-to-edit-own-posts/#post-2002913

If you still need assistance with this ticket issue, please let me know and I'll do my best to help. If no, please mark this ticket as resolved and open a new ticket for any issue/question.

#2005091

My issue is resolved now. Thank you!