Support

Account

Home Forums Search Search Results for 'reusable group'

Search Results for 'reusable group'

reply

  • Hi @voteforpedro

    We have a thread with the same request before. Here’s the link: https://support.advancedcustomfields.com/forums/topic/reusable-field-groups/.

    Unfortunately, it’s not possible in the current version of ACF yet. If you want, you can use the PHP code to make the field groups dynamically. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/register-fields-via-php/.

    I hope this helps 🙂

  • Hi James, thanks. Right, so it looks like it is a problem with the server. It is running into some sort of execution error after about 30 secs and taking me to a “service unavailable” page. Updated the max input vars as well as execution and input time in php.ini, but am still receiving the same problem. I also called support and they said suhosin was not enabled on the server and there wasn’t much else they could do.

    Simply uploading the acf-json directory in my theme won’t work either because I am using that reusable field group plugin and I lose it’s functionality when using only the acf-json. Syncing doesn’t work either because I run into the same problem on the server as when importing the json files directly.

    Also, debugging live is pretty much not an option. I can duplicate the install and all of it’s plugins on another server, but I think that might defeat the purpose.

    I guess I could manually build the fields, but in the long-run it’s just not a viable solution. Really scratching my head on this one…

  • Hello,

    Not sure if you are still needing this, but I had exactly the same situation as yours. I had button that have crazy conditions with multiple fields and needed to be used on many different field groups.

    So I’ve created acf-component-field plugin, that does exactly what you described. Component Field Group are reusable and nest-able, with no extra php functions or classes you’d need to initiate in your theme.

    Demo can be found here: http://gummi.io/acf-component-field/
    Please feel free to play around in the backend and see how it’s setup.

    I hope this helps you and anyone else who’s looking for this type of functionality. 🙂

  • Yes there is a way to limit the max number of each layout. When editing the layout, below the layout label and name are 3 additional fields including “Min” and “Max” these are for setting the minimum and maximum number of this layout that can be inserted.

    As far as the related question, this topic has come up may times. http://support.advancedcustomfields.com/forums/search?bbp_search=reusable+group

  • @delwinv, can you post an issue on my github repo? https://github.com/Hube2/acf-reusable-field-group-field/issues. Since this is my add on I’d rather not clutter up this forum with it. If you can attach a .zip file of example field groups I can test with that would be really helpful. I was recently working on fixing the conditional logic issue and I thought I had it.

    Edit: I created the issue, but I could still use a .zip file with groups to test with. https://github.com/Hube2/acf-reusable-field-group-field/issues/10

  • This plugin is a similar concept to the one you mentioned, it does allow conditional logic to be used, but for the entire group of fields. It does not allow conditional logic for individual fields in the field group being used, so not sure it will help you. https://github.com/Hube2/acf-reusable-field-group-field

  • This may be something that gets added to ACF. I know that the developer is thinking about it.

    There are some current options.
    ACF4: https://github.com/theideabureau/acf-reusable-group-field

    ACF ?: https://github.com/tybruffy/ACF-Reusable-Field-Group/ there are several forks of this one, I’m not sure which on to use.

    There is also mine that works with ACF5: https://github.com/Hube2/acf-reusable-field-group-field
    and I have this one that has a field group duplicator if you enable it that will copy field groups to multiple options pages: https://github.com/Hube2/acf-options-page-adder

    and there is this one that lets you build field groups with code that will also let you share fields in multiple groups. https://github.com/fewagency/fewbricks

  • My fork of the aforementioned plugin is in: https://github.com/devgeniem/acf-reusable-field-group/

    It features the fixes mentioned before but also makes the included field groups to obey their location rules and also adds a new location rule: “show only if this group is included to another”.

  • The developer is looking into the possibility of adding this to ACF.

    Until then you can try this add on plugin for ACF5 https://github.com/Hube2/acf-reusable-field-group-field

  • I have had a go at creating an extension that allows for creating field groups programatically which in turn allows for reusable field groups and more.

    http://support.advancedcustomfields.com/forums/topic/fewbricks-an-acf-extension-for-reusing-fields-and-much-more/

  • This weekend I started looking at the available plugins for reusable field groups. Testing and research turned into an entire weekend and at the end I had created my own version of a reusable field group field.

    It works a bit differently than the others, it works by rebuilding field groups that include a reusable field group field ans local field groups which override the original field groups. This only works in ACF5, ACF4 does not support acf_local().

    I have not completely tested it and would be interested in feedback or bug reports. I’ll also answer question. There’s not documentation yet, mostly because I think that the instructions when creating the field are pretty self explanatory.

    https://github.com/Hube2/acf-reusable-field-group-field

  • This weekend I started looking at the available plugins for reusable field groups. Testing and research turned into an entire weekend and at the end I had created my own version of a reusable field group field.

    It works a bit differently than the others, it works by rebuilding field groups that include a reusable field group field ans local field groups which override the original field groups. This only works in ACF5, ACF4 does not support acf_local().

    I have not completely tested it and would be interested in feedback or bug reports. I’ll also answer question. There’s not documentation yet, mostly because I think that the instructions when creating the field are pretty self explanatory.

    https://github.com/Hube2/acf-reusable-field-group-field

  • This weekend I started looking at the available plugins for reusable field groups. Testing and research turned into an entire weekend and at the end I had created my own version of a reusable field group field.

    It works a bit differently than the others, it works by rebuilding field groups that include a reusable field group field ans local field groups which override the original field groups. This only works in ACF5, ACF4 does not support acf_local().

    I have not completely tested it and would be interested in feedback or bug reports. I’ll also answer question. There’s not documentation yet, mostly because I think that the instructions when creating the field are pretty self explanatory.

    https://github.com/Hube2/acf-reusable-field-group-field

  • This weekend I started looking at the available plugins for reusable field groups. Testing and research turned into an entire weekend and at the end I had created my own version of a reusable field group field.

    It works a bit differently than the others, it works by rebuilding field groups that include a reusable field group field ans local field groups which override the original field groups. This only works in ACF5, ACF4 does not support acf_local().

    I have not completely tested it and would be interested in feedback or bug reports. I’ll also answer question. There’s not documentation yet, mostly because I think that the instructions when creating the field are pretty self explanatory.

    https://github.com/Hube2/acf-reusable-field-group-field

  • This weekend I started looking at the available plugins for reusable field groups. Testing and research turned into an entire weekend and at the end I had created my own version of a reusable field group field.

    It works a bit differently than the others, it works by rebuilding field groups that include a reusable field group field ans local field groups which override the original field groups. This only works in ACF5, ACF4 does not support acf_local().

    I have not completely tested it and would be interested in feedback or bug reports. I’ll also answer question. There’s not documentation yet, mostly because I think that the instructions when creating the field are pretty self explanatory.

    https://github.com/Hube2/acf-reusable-field-group-field

  • I started looking into making a reusable field group field after my last comment. Testing and research turned into an entire weekend and at the end I had created my own version of a reusable field group field.

    It only works with ACF5. It works by rebuilding field groups that include a reusable field group field ans local field groups which override the original field groups. The reason it only works with ACF5 is that acf_local() is not available before 5.

    I have not completely tested it and would be interested in feedback or bug reports. I’ll also answer question. There’s not documentation yet, mostly because I think that the instructions when creating the field are pretty self explanatory.

    https://github.com/Hube2/acf-reusable-field-group-field

  • There is a plugin that was created by someone that is supposed to do this. I haven’t had the chance to try it out yet.

    https://github.com/tybruffy/ACF-Reusable-Field-Group

  • +100.

    I’ve had some success with using this: https://github.com/tybruffy/ACF-Reusable-Field-Group

  • +10 for having this functionality built in. I’ve been thinking of ways to do this for a while now. It’d be great to abstract out custom field groups and set them up for reuse later.

    Many examples of this such as: a big select list that will need to be managed but used in multiple places on the site, complex groupings like for a button field where you need a text field paired with a page link or url and a select list of styles or colors…

    I’ve tested out the https://github.com/mvpdesign/acf-reusable-field-group add-on field and am impressed thus far. Grabbing the data is a bit different in that it returns all the values in an array, but once I realized that it was easy to work with. But I think the interface in the back-end used here is the ideal way to do it. It keeps it all very simple.

  • I tend to use the second example, where the prefix matches the slug of the CPT I’m using them on. book_authour etc. On options pages I use a prefix that indicates the type of option it’s for, for example site_options_field_name. I have, in the past used a prefix that represented the client, but I stopped doing that when I started reusing field groups and needed to rename them all to match another client.

    To be honest, I don’t think that there is a “standard WordPress practice” except that the top level fields should have a prefix and I try to make sure that my field names will not conflict with any of the more popular plugins, and I like using things that will be reusable.

  • @floflo91 thanks for the help! That one works well for the normal fields inside the Reusable field but not for a flexible field inside a Reusable field.

    i tried to use print_r
    <?php print_r(get_sub_field('modules_custom_reusable')); ?>
    which outputted:

    Array ( [modules_custom] => Array ( [0] => Array ( [acf_fc_layout] => module_sample [content_title] => text field inside flexible ) ) [content_title] => text field outside flexible )

    So it is picking up the content of the flexible field i just don’t know how to pull them out separately and apply the layout fields. :/ Will try it more.

    Here are the templates for the normal fields in case anyone will need them.

    Inside a repeater:

          <?php if( have_rows('repeater') ): ?>
    
              <?php while( have_rows('repeater') ): the_row(); ?>
    
                  <?php
                  if (get_sub_field('reusable_field')) {
                    foreach (get_sub_field('reusable_field') as $p) {
                      echo $p;
                      the_sub_field('subfieldName');
                      the_sub_field('subFieldName2');
                    }
                  } ?>
    
              <?php endwhile; ?>
    
          <?php endif; ?>

    inside a flexible field type:

    <?php
    
    if( have_rows('flexible') ):
    
        while ( have_rows('flexible') ) : the_row();
    
            if( get_row_layout() == 'layout_flexible' ): ?>
    
                  <?php
                  if (get_sub_field('reusable_field_group_')) {
                    foreach (get_sub_field('reusable_field_group') as $p) {
                      echo $p;
                      the_sub_field('subfieldName');
                      echo "<br>";
                      the_sub_field('subFieldName2');
                    }
                  } ?>
    
           <?php elseif( get_row_layout() == 'other' ):
    
            endif;
    
        endwhile;
    
    else :
    
    endif;
    
    ?>
  • Test with get_sub_field function

    if (get_sub_field('reusable_field_group_for_text')) {
    	foreach (get_sub_field('reusable_field_group_for_text') as $p) {
    		echo $p;
    		the_sub_field('subfieldName');
    		the_sub_field('subFieldName2');
    	}
    }
  • @floflo91 hm.. couldn’t make it to work.

    I also started from scratch and made a field group with just 2 text fields.

    Made a second field group with the reusable group and called the first one.

    Made 2 tests in the template:

    Test A
    <?php the_field('reusable_field_group_for_text'); ?>
    
    Test B
    <?php
    if( have_rows('reusable_field_group_for_text') ):
    while ( have_rows('reusable_field_group_for_text') ) : the_row();
    echo "TEST";
    endwhile; endif;
    ?>

    TEST A output was and array of both text fields, although i would want to call them separately.
    TEST B code didn’t work so maybe i just don’t know how to call the Reusable field type and it’s contents correctly :/ Even without any repeater/flexible.

    Too bad the plugin docs don’t have any usage code for it.

  • @floflo91 thanks for the help!

    I used the plugin you mentioned and the logic seems fine on the backend etc.

    A Repeater field (so i can mix and match the flexible content)
    A.1 Checkbox to choose to have flexible content A or B
    A.2 Reusable field of Flexible content A (core modules for use on other websites)
    A.3 Reusable field of Flexible content B (specific custom modules used for specific website).

    The frontent/template part is a bit tricky.

    Repeater field
    – checkbox
    — Reusable Field group (ex. modules_main_reusable)
    — Flexible content field (ex. modules_main)
    —- Field types for the flexible layout

    How should i call the modules_main_reusable field type? like this:

    if( have_rows('modules_main_reusable') ):
    while ( have_rows('modules_main_reusable') ) : the_row();

    And then add the flexible repeater code inside it?

    
                        <?php
                        if( have_rows('modules_main') ):
    					while ( have_rows('modules_main') ) : the_row(); ?>
                              <?php  if( get_row_layout() == 'module_sample' ): ?>
                                <?php get_template_part('templates/modules-main/module', 'sample') ?>
                              <?php endif; ?>
                         <?php endwhile; endif; ?>
    
  • @darisi Please be aware that there are multiple Reusable Field Group plugins:

    https://github.com/mvpdesign/acf-reusable-field-group
    https://github.com/tybruffy/ACF-Reusable-Field-Group

    I’m using the second, i don’t know how the first one works.

Viewing 25 results - 26 through 50 (of 71 total)