Support

Account

Home Forums Backend Issues (wp-admin) How to Add Contact-Form-7 to a WordPress Theme

Solving

How to Add Contact-Form-7 to a WordPress Theme

  • Hello everyone,
    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
    http://codex.wordpress.org/Shortcode

  • Hello Amin,
    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.

    Thanks

  • 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.

  • Hello @robertark,
    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,
    http://codex.wordpress.org/Function_Reference/wp_insert_post
    2. Import an XML after theme activation( honestly i don’t know if it’s possible )

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘How to Add Contact-Form-7 to a WordPress Theme’ is closed to new replies.