Support

Account

Home Forums ACF PRO Backend: Use Accordion in Tabs does not work

Solving

Backend: Use Accordion in Tabs does not work

  • Hello, dear ACF Team!

    I have TABs and inside the tabs Accordion:

    [TAB1]
    [Accordion1]
    [Accordion2]
    [Accordion3]
    [/TAB1]

    [TAB2]
    [Accordion1]
    [Accordion2]
    [Accordion3]
    [/TAB2]

    With the plugin: https://de.wordpress.org/plugins/acf-accordion/ Was that possible.

    Is this a bug? Unfortunately, it does not work with ACF PRO.

    Thank you for your help.

  • I’ve been using ACF since the first version and do not want to miss it anymore and Elliot is really doing a good job.

    But the new version with the Accordion feature disappoints me a little bit:

    1. The core Accordion field is called with the same class name as the plugin
    Accordion Tab Field, which has been available for a long time (4000+ active installations). The result is that after updating to the new ACF version, should the Accordion plugin be active, WordPress will stop working with a Fatal error!

    And the new Accordion field is using the same field name as the plugin.

    Even customizing the class name in the Accordion Tab Field plugin would not solve the problem, since the field name is the same. Thus, fields previously assigned to the Accordion of the plugin would now be mapped to the core accordion. The result: The fields do not work anymore!

    The plugin should also be known to Elliot and he should have taken more care here and choose a different class name / field name so that this error does not occur!

    2. That the new core Accordion does not work in tabs is incomprehensible. Even with the idea of implementing such a function, one would have to come up with the idea that this function will also be used in tabs. And the Accordion plugin shows clearly that it is possible.


    @Elliot
    Why did not you contact the developer of the Accordion plugin and talk about taking this feature into the core of ACF? That would have saved everyone a lot of trouble. Why is a new feature not tested with all other modules (especially the tabs)?

    Fact no. 1 should be solved very quickly, because the update of ACF would break all sites using the Accordion Tab Field plugin!!!

    I hope the new Accordion function is revised very quickly, so that we could work with it reasonably.

    Excuse my harsh words, but I had to get rid of that.

  • I think I’ll have to agree with Thomas here. Using accordion tabs plugin also and 5.6.6 crashed my site with fatal error due to a naming collision. Cost me about 7 hours today to figure it out as I was updating many plugins at once and had to determine which one. Only option is to roll back to the previous version. Please fix the naming collision and test with all related plugins in the future. Absolutely killer plugin, but this was a basic mistake it seems.

  • Hi guys

    Thanks for the emails,
    Elliot here – ACF dev​​​.

    I appreciate the ​​​​​feedback. I never want to break websites, so I do take this personally.
    I have just pushed a hotfix to avoid the class name change.
    – I have changed ‘acf_field_accordion’ to ‘acf_field__accordion’.​​

    If you would like this fix, please re-download the plugin files.
    ​An easy way to re-download is to edit the main acf.php plugin file and change the version number ‘5.6.6’ down to ‘5.6.5’
    – please note the version number appears twice in this file and both will need to be changed
    – after this change is made, please update the plugin as per normal and it will update to 5.6.6 (including the new fix)​

    As for the accordion and tab conflict. Yes, this isn’t great and I’ll be sure to find a solution for this shortly.
    Hope everything else is going well.​​​

    Thanks
    E
    ​​​​

  • Hi Elliot,

    thanks for your reply and the information.

    But your fix doesn’t work at all. OK. – the fatal error is gone, but since ACF and the plugin still use the same field name, we now have a mix of both types of fields.

    The results are blank and very narrow bars that do not open the contents of the accordion.

    I think you have to rename the field name as well!

    Thanks
    Thomas

  • Elliot,

    I noticed 5.6.7 was available but said only that it resolved a number of bugs, without specifying whether it is the one we’re discussing here. I understand you targeted the naming collision in 5.6.6 to resolve the fatal error, but it did not seem to quite address the UI per Thomas’ response above. Was that part of 5.6.7?

    Thanks,

    Mark

  • I tested the accordions with the new ACF v5.6.7. If you want to use the accordions within tabs, you must use a last accordion field with “Endpoint” set to Yes before you start the next tab.

    It’s a bit more complicated than with the Accordion Tab Field plugin – but has the advantage that you can also create tabs within an accordion.

    The only downer: If you have a site already using the Accordion Tab Field plugin both accordions not working. That’s because the core accordion and the plugins accordion using the same field name in code. That’s why ACF’s script and CSS for the accordion also affects the fields created by the plugin and vice versa.

    Since I use the plugin on many pages of my clients, I’ve been looking for a solution to continue to use the plugin (so I do not have to change all affected fields) and still be able to update to the new ACF version.

    Here is my approach (for ACF Pro only):

    First be save that you didn’t have set up accordion fields with the new ACF core accordion field. Otherwise, these will also be changed.

    I changed the field name in the Accordion Tab Field plugin acf-accordions-v5.php and all necessary class names in the .js and .css files to an unique name (e.g. my_accordion). The affected class names are:
    .acf-field-accordion -> .acf-field-my-accordion
    .acf-field-object-accordion -> .acf-field-object-my-accordion)

    After that the old accordion fields are broken and now you should not update the field groups.

    Now you have to go into your database and open the wp_post table (change the suffix “wp”, if you have defined your own suffix in the wp-config.php).

    I DO NOT NEED TO REMEMBER THAT WORKING ON THE DATABASE ALWAYS REQUIRES A DATABASE BACKUP FIRST

    In this table all the accordion fields are saved. To list them all query like this:
    SELECT * FROM wp_posts WHERE post_content LIKE '%"type";s:9:"accordion"%'

    To change this entries use a query like this:

    UPDATE wp_posts
    SET post_content = REPLACE(post_content, '"type";s:9:"accordion"', '"type";s:12:"my_accordion"')
    WHERE post_content LIKE '%"type";s:9:"accordion"%'

    The replacement string must contain the field name you set in the acf-accordions-v5.php and you have to set the s parameter to the length of that string. In the example query the field name my_accordion is used and therefore it must be s:12.

    Now your fields are re-linked to the Accordion Tab Field plugin fields.

    I hope this approach works for anyone who wants to use the new ACF v5.6.7 and the plugin together.

  • Accordion in Tabs do still not works.

    This bug is over 1 year old.
    Will it ever work, Elliot? 🙂

    Im using Advanced Custom Fields PRO 5.7.12.

  • Hey! Accordion in Tabs worked for me when I did what was mentioned earlier in this thread. Create one more Accordion and place it before the Tab field. Set that Accordion to use the Endpoint setting and voila, it works.

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

The topic ‘Backend: Use Accordion in Tabs does not work’ is closed to new replies.