Dynamically create a page/langing page

By: Shawn Fawcett | Asked: 08/11/2022
ForumsCategory: General questionsDynamically create a page/langing page
Shawn Fawcett asked 2 years ago
I am building a client area where they can build landing page campaigns and am a little stumped. I need to find a way for the client to pick a pre-built template and then add their content for multiple landing pages. The content part is fine but I am wondering if there is a way to build dynamic landing pages/pages. Any pointers in this direction would be appreciated. 
1 Answers
Bobby Clapp answered 2 years ago
I guess I envision this as a form that collects some data that will show up in the landing page they choose. You then will have an option to select a list of known templates (by name) within this data collection form. Then you would create a view from the form and set up conditional sections throughout the view with the content as you choose to show it. That's one way of maybe a few. [if x equals="template-1"]Add your content here this way[/if x] [if x equals="template-2"]Add your content here that way[/if x]
Shawn Fawcett replied 2 years ago

Hmm, I'm not sure I follow. I was thinking more of creating an actual page or dynamic page I suppose. The user would be able to name it in a field in the form

Bobby Clapp replied 2 years ago

Have you reviewed this page then?


Shawn Fawcett replied 2 years ago

Yes, I did yesterday thx. I think it might be part of the solution but I don't want the client to need to add any code or shortcode. The code should already be in the templates.
eg landing page template1 with picture on the left and form-number-2 on the right. These would be pre-coded so the client can add their own picture and text but the form would be pre-set. Make sense?

Bobby Clapp replied 2 years ago

Yes. So you might do a combination of things. Create a view, then set the form to create a post (maybe page) here with Dynamic content that looks at the view as suggested previously.

Shawn Fawcett replied 2 years ago

Have you seen examples of this done so i can wrap my head around it? I will play around with it but don't want to reinvent the wheel.

Bobby Clapp replied 2 years ago

I don't. It likely will take a bit of experimenting to wrap your head around it. Watch the video below though. Particularly at about 1:30 he goes to select the view associated with the post to be created. You can create a view or use an existing view. You can change the post type to page if that is what you wish to use instead.


Then in the view you use or create, put in the previous snippet I proposed:
[if x equals="template-1"]Add your content here this way[/if x]
[if x equals="template-2"]Add your content here that way[/if x]

template-1 would be maybe text on the left and then image on the write, however you code it. Then maybe template-2 is the opposite of that. You simply put your image on the left and then text on the right. Create an entry from the originating form and then view the content as you've filled out the form from the post/page it creates. Then go back into that entry on the backend, edit it and choose the opposite template and then return to the previous page and see the layout change as you've defined in the template based on the shortcode written above (with your design in the "Add your content here" parts.

Shawn Fawcett replied 2 years ago

ok, I'll do some experimenting over the weekend and check back in. Thx @Bobby

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community