Home Forums ACF PRO ACF in premium theme: add tables when installing theme


ACF in premium theme: add tables when installing theme

  • Hi there,

    I am currently developing a premium wordpress theme with the help of ACF. The problem I have is, that when I zip the theme and want to install it on another web, none of the acf-fields I made are getting installed.

    So I would like to know, if it’s possible to add those tables in the database, when the theme is installed. Or is there another approach to this problem?

    Thx a lot,

  • This is kinda off the top of my head. So there may be a better solution, as this is untested and might not even work. LOL 😛

    The first thing you need is to ensure that the plugin is included and activated upon install…

    So I would add the plugin to the theme via functions.php:

    // set the path to the includes folder
    define('THEME_INCLUDES', TEMPLATEPATH . '/inc/');
    // load the ACF plugin
    require_once (THEME_INCLUDES . 'advanced-custom-fields-pro/acf.php');
    // hide the custom fields menu from the dashboard
    define( 'ACF_LITE', true );

    then include ACF within your theme structure:


    and so on

    Then in your dev theme, after you’ve created all the custom fields goto Custom Fields > Import/Export choose all the fields you want to export, then click “generate export code” copy that code and paste it into your themes functions.php file.

    This assumes you just want to add the existing fields and not any content you have added to them.

    You will also probably want to make heavy use of:

     if ( !empty('field') ) { 
      // do this 
     } else {
      // do that

    Hope this helps in some way. 🙂

  • We have the same problem 🙁

  • thx ben, I think this is the way to go, as the ACF-Support also told me to export the fields through the backend and then import them through the functions.php of my theme.

    thx a lot!!

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

The topic ‘ACF in premium theme: add tables when installing theme’ is closed to new replies.