Skip Navigation

[Resolved] Editable form on home page OR content template as (home) front page

This support ticket is created 4 years, 6 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)

This topic contains 12 replies, has 3 voices.

Last updated by anthonyP-5 4 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#1868381

Tell us what you are trying to do?
Hi,
I'm trying to create a portfolio site for clients that can be used as a template that they can edit on the front end w/their own information, pictures etc.

Is it possible to either:
1. Create a Content Template and somehow use it as my homepage (frontpage) OR

2. Is it possible to make a page (Home, in this case) editable on the front end as you would be able to edit a Content Template on the front end.

I've tried to figure out both and was unsuccessful. I've also tried to search both and came up empty 🤷🏻‍♀️

Thank you.

#1868669

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Screenshot 2020-12-08 at 10.50.32.png

I'm not sure I follow what you mean, particularly "as you would be able to edit a Content Template on the front end". Content Templates are edited in the back-end.

The only front-end editing ability is to edit posts using Forms.

If you edit a page, e.g. the home page, then you should see that you can assign a Content Template to display the page content (screenshot), not sure if that helps.

#1868763

Hi,
Thanks, I did see that after I sent my message. But it's no longer editable on the front end when you do that. So, now the home page shows the content template but it's no longer editable on the front-end and I don't see the information from the custom fields or cpt.

In other words, I have say, "Bob" as an entry for the CPT w/the CF "Name," "School" "hobbies" his picture etc. I want his information (portfolio) to show up on the front-end and to be editable so that if he wants he can swap out his picture and edit his information.

So, I created a content template w/the layout and all dynamic info that I need. Also created a form to edit that content template on the front-end. It seems to work but when I added the content template to the home page, the edit link no longer appears and neither does "Bob's" information.

#1868867
Screen Shot 2020-12-08 at 7.50.20 AM.png
Screen Shot 2020-12-08 at 7.47.13 AM.png

This might help explain

#1869165

Also created a form to edit that content template on the front-end.
I think I need to clarify a bit more based on this statement. Again, as Nigel said, it is not possible to edit a content template with Forms. Content Templates can only be edited in wp-admin. On the front-end, it is possible to edit some post using an Edit Post Form, and that's what I think you mean here. You can place that Edit Post Form inside a Content Template. To edit some post using that Form, you would insert an Edit Post Link in the View or template where the post-to-edit is displayed. This Edit Post Link will link the User to a page where the Edit Post Form is displayed inside the Content Template that contains the Edit Post Form block. This is the typical workflow for editing a post with Forms, as described in our documentation here: https://toolset.com/course-lesson/front-end-forms-for-editing-content/

So if "Bob" is a post in some custom post type, for example a "Clients" CPT, and you want a User to be able to edit the Bob Client post using an Edit Client Post Form, normally you would create an Edit Client Post Form in Toolset > Post Forms. Then you would place that Form inside a new, unassigned Content Template using a Form block. Then you would insert an Edit Post Link using the Single Field Block inside the Bob post editor, or inside the editor for the Content Template applied to the Bob post. When you insert this Edit Post Link, you will be required to select a Content Template. You should select the unassigned template you created that includes the Edit Post Form block. This setup will display a link to edit the post when the User visits the Bob post on the front-end. On the front-end the User would click that link and be redirected to a page containing the Edit Bob Client Post Form.

If you want to display an Edit Post Link in an area other than the Bob post page or a View displaying the Bob post, like the site's homepage as you mentioned, you would need some way to determine which Client Post you want the logged-in User to edit, since obviously there can be several Client posts on your site. Usually you must use a View of Client posts to determine the appropriate Client post, via some filtering applied to the View. For example, if the logged-in User is the author of the Bob Client post, then you would apply a Query Filter in the View based on the Client post author, where the author is the same as the current logged-in User. We have documentation about Query Filters for Views in the Block Editor documentation here: https://toolset.com/course-lesson/creating-a-view/#filter-the-list-of-posts

This View would then loop over results for each Client post authored by the current logged-in Users. In the loop block of that View, you would place an Edit Post Link using the Single Field block. That would produce a list of Edit Post Links for each Client post authored by the current logged-in User. When you insert this View in the homepage editor, it would display that list of Edit Post Links to the current logged-in User on the homepage. Alternatively, you can place the Edit Post Form directly in the loop of this View using a Form block, to display the Form on the page without the use of an Edit Post Link.

If the logged-in User is not the author of the Client post, I would need to know more about how Client Posts are related to logged-in Users to give you more accurate information about how to configure the View.

#1869183

Thank you so much for your detailed response!

I have most of this down (I think I used the wrong terminology). I'm good with almost everything...

Just to clarify even further now that I've been tinkering with this, there will only be ONE logged-in user, not several clients as I previously stated (maybe two users if you count the dummy content I need to place so the client can see what the layout looks like).

Since it's a multisite, I plan on using the same template but on different sites per user. So, a person would come to my site, choose a template and then populate that template w/his own information and create his own domain name for the site (wp ultimo & domain mapping).

Since it's just one user now logging in, does that change these directions that you wrote:

"If you want to display an Edit Post Link in an area other than the Bob post page or a View displaying the Bob post, like the site's homepage as you mentioned, you would need some way to determine which Client Post you want the logged-in User to edit, since obviously there can be several Client posts on your site. Usually you must use a View of Client posts to determine the appropriate Client post, via some filtering applied to the View. For example, if the logged-in User is the author of the Bob Client post, then you would apply a Query Filter in the View based on the Client post author, where the author is the same as the current logged-in User. We have documentation about Query Filters for Views in the Block Editor documentation here: https://toolset.com/course-lesson/creating-a-view/#filter-the-list-of-posts..."

Or, is there an easier way?

Sorry this is so confusing and I am most appreciative of your help. It would be AMAZING if I could get this to work and I think I am very close!
Thanks, again.

#1869257

Since it's just one user now logging in, does that change these directions that you wrote:
The number of Users logged in simultaneously is irrelevant in this scenario. The relevant thing is the number of posts that are possibly editable from the front-end of the site, since you're saying you want to allow the User to edit some post. In the previous example, I used "Bob" to represent the editable Client post, and I explained how to use a View of Client posts to determine which Client post should be edited in the Form. If only one Client post will ever exist on the site, then you need not filter the View of Client posts by post author. You could instead filter the View by that known Client Post's numeric ID, since there is only one Client post and the post ID is static, i.e. it will always be the same whenever anyone visits the site. Whatever person logged in will always edit the one Client post: Bob.

However, if a different person logs in two weeks from now to create their own, separate site in your multisite network, and edits the same Bob post from the front-end of the site, the original User's edits to Bob will be overwritten by the new User's edits. So if you need to maintain separate edits for each User, you need separate Client posts - Bob and Tom, for example. Each User would need to create their own Client post when they log into the site the first time, so that their individual options could be maintained separately. You can create a New Client Post Form and display it to new Users, prompting them to "create a profile" or something similar. That would generate a Client post specific to each User.

- User Bob logs in to create his site. You display the New Client Post Form and Bob creates his own Client Post: Bob. There he can add his own individual information. After the post is created, you can display an Edit Post Form as well so he can make modifications as necessary.

- Later Tom logs in to create a subsite in the same multisite network. He goes through the same process to create his own Client post: Tom. His information is stored in the Tom post, not modifying the Bob post. To display Edit Post Links, you need to know which Client post you want him to edit - Bob or Tom?

Now you may understand better the need to filter the View of Client Posts by post author to display the correct edit post links and edit post Forms on the front-end of the site, because the original User should edit Bob but the new User should edit Tom. Whether these Users are logged in simultaneously or not is not relevant. In either case, you need to know which post the current User is allowed to edit. Is this making sense, or am I misunderstanding what you want to accomplish?

Since it's a multisite, I plan on using the same template but on different sites per user.
If you're referring to Toolset's Content Templates I want to advise you that it is not possible to access Content Templates directly, across subsites in the same multisite network. So if you have https://multisite.com as a network site, and you have subsites https://bob.multisite.com and https://tom.multisite.com for example in that network, you would manage Content Templates in https://bob.multisite.com and https://tom.multisite.com individually, not from pooled resources in https://multisite.com. If you want to reuse Content Templates across different sites, you can use Toolset's Module Manager plugin to export individual templates from one site and import them in another as a Module. Or, you can use Toolset's Export/Import features, but that process will not allow you to select individual templates. It is a bulk process that would export/import ALL templates. If you're referring to some other templating system, you can disregard what I just said. Just wanted to be proactive here.

#1869271
Screen Shot 2020-12-08 at 1.21.30 PM.png

Thanks again. I'll look this all over to try to implement. Last question, but it's not related so I can ask in a separate ticket if need be.

I have a section called, "Hobbies" and the section has 3 columns w/3 container blocks that the client can fill out for 3 hobbies
BUT, the client only has 2 hobbies and doesn't fill out the last custom field (on a form) for the 3rd hobby.
SO, I don't want that last column or container to show on the section on the front-end.

Would I use conditional shortcodes to manage this or is there a better solution? Perhaps you can point me in the right direction.

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

https://toolset.com/forums/topic/hide-container-if-custom-field-is-empty/

#1869367

Sure, I've split that off into a separate ticket so we can discuss in more detail.

#1872131
Screen Shot 2020-12-10 at 2.21.33 PM.png
Screen Shot 2020-12-10 at 2.20.30 PM.png
Screen Shot 2020-12-10 at 2.19.07 PM.png
Screen Shot 2020-12-10 at 2.18.03 PM.png

Hi,
This just isn't working for me and it's really confusing. I must be seriously missing something.

Forget about editing on the front end for now.

How can I show a content template as the home page?

I set the home page setting to use the content template and there's nothing there.
I only have one CPT entry

#1872279

I can't see much about the design of the Virtual Me template in the Block Editor - maybe it would be faster if I log into wp-admin and see how it's configured? Private reply fields are available here for your security.

If I had to guess, I'd guess that in the Virtual Me Content Template editor you have selected up at the top of the editor to "View with" the Bob Tester post. That's a preview feature, but it does not influence the final output when the Virtual Me template is displayed while visiting the Home Page. At that point the template has no reference to the Bob Tester post. In this case, you probably need a View of Virtual Me posts on the homepage.

But I don't want to get ahead of myself, let me log in and take a closer look.

#1874575
insert-form.png

Okay I made some changes to demonstrate a few options.
1. I edited the Home Page to both delete the Virtual Me Content Template from the Home Page contents and unassign the Virtual Me Content Template from the Home Page's Content Template setting. I think this Content Template is leading to some confusion right now, so I've removed it temporarily and added other contents directly to the Home Page, for clarity. In a real world scenario, you should either apply a template to a page or insert the template in the page contents, but not both.
2. I created a View of Virtual Me posts, filtered it by post author equal to the current logged-in User, and placed it in the Home Page contents. This produces a loop over the current User's Virtual Me posts.
3. In the loop of the View of Virtual Me posts, I inserted an Edit Post Link at the top of the page. This will redirect the User to a page containing a Form that edits the Virtual Me post. Just below the Edit Post Link, I inserted the Edit Post Form directly in the page. This will display a Form to edit the User's Virtual Me post directly on the Home Page without needing an extra link. You can decide which approach is better, and delete either the Edit Post Link or the Form from the View of Virtual Me posts.
4. I created a Virtual Me post while logged-in as this temporary User. Now when I visit the Home Page I have the ability to edit the Virtual Me post I created, either by clicking the "Configure Virtual Me" link, or by submitting the Edit Post Form directly in the page contents.
5. Assuming you'd like to allow the User to creating the first Virtual Me post when they log in to the site initially, I created a New Post Form for Virtual Me posts:
hidden link
To display that Form to the User, I edited the View of Virtual Me posts on the Home Page and inserted the New Post Form shortcode in the View settings for what to display when no Virtual Me posts by the current logged-in User exists. See insert-form.png

So the effect is that when a User logs in without having a Virtual Me post created yet, the View shows that User the New Post Form to create their Virtual Me post. Then the Home Page reloads, and the View will present options to edit that post after it exists.
See the FAQ here for more information about this:
https://toolset.com/documentation/legacy-features/views-plugin/how-to-create-custom-searches-and-relationships-for-users/#how-do-i-prevent-users-from-creating-more-than-one-contractor-post

Let's discuss your opinion of these changes and go from there.

#1880301

My issue is resolved now. Thank you!