Custom form in Wordpress? - wordpress

I'm making a wordpress site which looks like and behaves less like a blog and more like a classic web site. I need to make plenty of custom forms and by now I have three equally bad solutions to this.
One would be to create each form as a theme template file. Those pages would submit data to themselves and all would be great, except the fact that I don't really like my plugin and theme to be so hardly connected. I think that theme should be for design only, which means header, footer, etc... and that plugin should handle all the other work.
Second solution is to make some controller.php file somewhere in my plugin folder and then all requests should be directed to this controller which would control what page should be displayed and how. And each page should be made with the use of WP short codes located inside my plugin folder. Problem with this approach is that I have problems transfer POST parameters, after I submit a form. I would submit a form to my controller which would then redirect it to a page with all POST parameters lost.
Third solution would be to target actual pages which display content with the use of WP shortcodes, and when user successfully submits the form shortcode would instead of the custom form, return some Thank you message. Problem here lies in fact that if you hit refresh while Thank You message is displayed browser would submit the form once again. And again and again, every time you'd press refresh.
Simple question. How would you do it?
Would it be the first way? I see many people doing just that, hardcoding their custom forms inside template files, even though it may be not the cleanest solution. Hmm... Still, I would like to separate my forms and logic away from my theme.
Greets

There are a couple of good form solutions as existing plugins. The two that come to mind immediately are Gravity Forms, which you must purchase:
http://www.gravityforms.com/
or Formidable Forms, which has a free basic version and a paid advanced version:
http://wordpress.org/extend/plugins/formidable/
I would definitely suggest using a plugin. It's best to keep design and functionality separate when possible. Both of these plugins are pretty simple to use. I know formidable uses shortcodes, but I'm not sure about Gravity Forms

Related

Combine HTML site with Wordpress

I have a website i coded alone with HTML, CSS, JS and JQuery, and I want to add service payment functionality (not e-shop with items, but give clients the ability to submit forms, pay on the website and receive the appropriate services online, so they don't have to come on-site. I want to use WordPress so I can use the woocommerce plugin, cause I'm feeling that's a safer option that coding something myself. How can i get my site and woocommerce working together without having to create the website again using plugins? I know that i can add code blocks, but that means I'll have to keep the title panel on top of the page, and I find that unappealing, and the plugins that exist for removing those aren't a great solution imo. can someone help?
Per my personal opinion, you can do this by simply installing wordpress and then a basic theme. then installing all you need for your woocommerce. then a link that goes to the woocommerce whenever it needs to go there. It is not really a big deal.
Eg a menu that says buy now with a link to woocommerce and predefined amount. so when the user clicks the buy now button, it goes to woocommerce to continue.
so your website will be in 2 parts. a part for information (Your HTML Site) and a place for interactions (Wordpress).
Some websites have similar instances where depending on what you are doing the theme changes.
I however will recommend you go through the pain of doing your whole site on wordpress or simply finding other options to integrate the payments you want to in your current design.
This is for a uniformed design and will make your users/clients feel more secured instead of feeling they are being moved through sites.

How to have single-slug behave like a normal page in WordPress?

I'm making a website in WordPress, and I'm using a plugin ACF PRO. I'm doing the entire site with flexible content, so the WordPress site is like a page builder.
Everything is fine, however, I came to a point where I need to have same functionality for single-[custom-post-type], so I can "Add row", header, footer etc... on it, but I can't figure out on how to do it.
I know that it's possible, because e.g if you look at this site here: https://rolleragency.co.uk/our-projects/
You can see that it works. I know they are using flexible content because I worked on that site and I did there what I wanted. I can't remember how to do that.
I think I had to use a Tempate Page? Or? I can't remember.
THe site is built entirely on flexible content, so everything there is modular and it's like a drag and drop, but how do I do that on single-slug?
You have to create a page template, yes.
So something like page-projects.php then in WordPress admin you would have a page called Projects.
The template you created should be automatically applied to this page. If it doesn't for some reason you can choose which template WP should use on the right side when editing a page.
Now, you can add whatever code you need to the page-projects.php. And also any fields you may need for that page you can set up in ACF by telling ACF to apply those fields to pages that use projects template.
This is how I would and did do it on several occasions :)

How do I call a plugin in a custom page for wordpress?

So I am trying to do this and I don't know how. I have a wordpress powered website with a plugin called "frontier-post" in it. This plugin makes a new front-end post submission. The way to use it is to put the shortcode "[frontier-post]" in any post in my wordpress page and that page turns into this.
I want to make a custom page for myself, where I can have the content created by this plugin there too. So I do not want it to be a post in my wordpress, but lets say at a corner in the custom page. I have searched and found these but the suggestions there would not work. I am able to include the wordpress so that the custom page has access to posts, etc. but even using this
echo do_shortcode('[frontier-post]');
would not help me. (even if header is included)
These are the similar things i found:
Wordpress/PHP - How to use plugins outside wordpress-powered pages?
Need Help for my Custom Page Template
I would really appreciate it if you could help me with this.
If you are creating a PHP page that isn't going to be rendered inside WordPress, you can't use a Plugin of the WordPress engine to accomplish what you are wanting to build. (As the accepted answer to one of the pages you link to indicates).
Instead, you might be able to use the json-api plugin and have your custom page query it for the data. While it won't render the shortcode, it will give you the raw data to work with.
http://wordpress.org/plugins/json-api/
Edit:
Based on a comment, your do_shortcode should work...just try it without the square brackets.

Shopify app integration theme issue

I am developing application for shopify, which replace login and register links to another links, creating a custom pages. For example when user click to login link? it is not redirect to login page, it is open a popap with login form. Also my app create custom pages. For example people page, where shows list of customers. And also a want to customize product page by adding a new fave button. In people page for each people shows count faves and last three faves product with images.
So my problems is theme layouts. Because each theme have self layout and css. I want to my app support all themes. How can i do it?
Sorry for my bad english. I just learning... ))
You have two options here, http://docs.shopify.com/api/tutorials/application-proxies and http://docs.shopify.com/api/scripttag.
App proxy sounds like the solution for your separate 'peoples' page.
If you want to assume that all themes have a log in link (which they all should but it's completely customizable so it's possible some don't), then you could always do something like this
$("a[href='/account/login']").click(funciont() {// show modal}); This isn't guaranteed to work in all themes but it probably will in most.

Which WP plugin for enabling users add posts without registration?

I would like to know which WP plugin should I choose to allow every user who come to my page to add a post to my page form the frontend.
He just click on a button add a new post or something like that. Than a form appear and he inserts the title and uploads an image.
After that its published as a post.
Is there a solution like this available for WP?
Thanks in advance.
From what I know, there is no existing plugin doing it as you need. Even if it existed, I wouldn't recommend it's use for security reasons; it is hard to follow every uses and make sure visitors would post the way you want.
You are definitely better to code it by your own, and it's quite simple using the wp_insert_post function. This function will work anywhere you put it inside Wordpress (no need to build a plugin from scratch), so a simple form with validation would make it.
Hope it guides you on what you're looking for.

Resources