• Resolved jonjoncs

    (@jonjoncs)


    Hello! Great Plugin!
    I’m using your plugin with ACF Flexible content. I used the tag with WYSIWYG to insert the footnote in a block, but tried to show the footnote in another block, and the content doesn’t appear.
    Its possible to work between flexible content blocks?

    • This topic was modified 10 months, 1 week ago by jonjoncs.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Golemiq

    (@awesomefootnotes)

    Hi there!
    Thank you very much! Highly appreciated!

    Haven’t tried with flexible content, but will check and get back to you.

    There is something to keep in mind though:

    Unfortunately there are limitations with the ACF because of its block structure. There is no way to guess how many blocks are there, which is first, second, are there more blocks or not … So every block will show its own footnotes, and shortcodes are not working outside them. Like said – currently there is no way to achieve that.
    What plugin does is to keep track of the footnotes and keep proper numbering among the blocks (again there is no way to guess which is which, so they are parsed in order of their callings from backend, but they can be shown in entirely different places on the front end.)

    The only possible solution is to probably skip the whole footnotes section, and show the footnote inline using JS – but that is work in progress still.

    Really hope that this is not a deal breaker for you 🙂

    Plugin Author Golemiq

    (@awesomefootnotes)

    Hi @jonjoncs
    Sorry for the delay – I’ve tried few approaches to the problem but without any success I am afraid.

    The problem comes, like I said, from the dynamic structure and the freedom of using the ACF fields (actually even the post content itself).

    Long story short – you can use the footnotes in ACF, but they have to appear in every block, as there is no way (except parsing the entire WP structure of showing the given content, which will take huge resources with questionable results).

    The only way around that, which I can think of, is to have an option to get rid of footnotes all along, and show them using JS right into the context, during the text reading on click or hover, depending on the device. I am currently working on such solution, using vanilla JS, but can not give you specific timeline when that will be available.

    Once again – sorry for the bad news.

    Plugin Author Golemiq

    (@awesomefootnotes)

    Closing this – if there is something else – don’t hesitate to open another one.

    Thread Starter jonjoncs

    (@jonjoncs)

    Sorry for not answering before, but I droped using the plugin and made myself an implementation in my theme, so if I can help you here’s how I could make it work.

    Basically I put some Footnotes along the flexible content text, textarea and wysiwyg, collected all the footnotes and after that, inserted the shortcode to show in the last acf content.

    Here’s the code:


    $footnotes = CustomFootnotes::getInstance();

    add_filter('the_content', [$footnotes, 'processText']);

    add_filter('timber/context', function ($context) use ($footnotes) {
    $context['footnotes'] = CustomFootnotes::getInstance()->toArray();
    return $context;
    });

    //add filter to acf fields
    add_filter('acf/format_value/type=text', [$footnotes, 'processText'], 10, 3);
    add_filter('acf/format_value/type=textarea', [$footnotes, 'processText'], 10, 3);
    add_filter('acf/format_value/type=wysiwyg', [$footnotes, 'processText'], 10, 3);

    //add shortcode for footnotes
    add_shortcode('footnotes', [$footnotes, 'show']);

    Thank you anyway for your attention!

    Plugin Author Golemiq

    (@awesomefootnotes)

    Great! Glad that you found a solution.

    Thanks for the code!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘ACF Flexible Content – List Footnotes’ is closed to new replies.