I am developing a WordPress theme which include Advanced Custom Fields with CF7 addon to call a Contact From 7 form. If I share that theme with anybody. Then, user for that theme have to struggle to work with Contact Form 7.
Is there anyway to embedd particular contact form 7’s form into theme to solve this problem. (As we export ACF fields and embed into theme).
Thanks in advance
Well i didn’t exactly what you’re going to do here , If you wanna ‘export’ a contact form then you can do it with WordPress export tools and import it to any website you want.
And if you wanna show a contact form you can use it’s short code
It s something like this – I have embed ACF free along with ACF-CF7 and ACF-fields. Why? Because I have a Contact form 7 for each item which take input from user. Contact form 7 will be added to plugins (not embedded).
With fresh installation, there will be no contact form to work with.
If I have specified a contact form 7 in ACF Contact Form 7 field. Then, it is not going to work with new installation.
So, any way to export contact from 7 to embed in theme will be a great help.
If you export via TOOLS -> EXPORT -> CONTACT FORMS and then import them via IMPORT -> FROM WORDPRESS, then there shouldn’t be any issues.
However, since ID’s can change between exporting/importing, we’ve always found it easier to copy an entire DB to the new site and just modifying the URL’s via DB Replace tool (see https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ )… this way, ID’s are maintained and nothing breaks.. but this isn’t recommended for existing sites as you’ll lose everything (unless, of course, the dev site is up-to-date already).
If anything, after doing the export/import, you may just have to go back through your pages and reassign your CF7 forms.
You are talking about a sample for entire collection. But, I am talking about whole collection.
Once, I develop entire theme and share it a collection or 1000 people. Then, I will encounter some with every kind of user – novice to master. No one will consider theme with such mess.
Is there any way to include contact form like we export ACF fields as php to embed into theme.
Any help will be appreciated.
Well i don’t know much about contact form 7 , But if it works based on post types you should be able to do this :
You should write a function that runs after theme installation,This function can be written in 2 ways :
1. Insert new contact forms as posts with wp_insert_post() function,
2. Import an XML after theme activation( honestly i don’t know if it’s possible )
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.