Support

Account

Home Forums Backend Issues (wp-admin) Problem with Footnotes plugin and ACF Pro

Solved

Problem with Footnotes plugin and ACF Pro

  • hi.

    There were several threads but it hasn’t been solved for me.
    I’m using this plugin: https://wordpress.org/plugins/footnotes/

    I have several ACF fields in my post, where i put footnotes. I put this function into my child theme functions.php file:

    function acf_apply_content_filter_for_api($value, $post_id, $field){
         return str_replace( ']]>', ']]>', apply_filters( 'the_content', $value) );
    }
    function add_content_filter_ACF(){
       if(!is_admin()){
          remove_all_filters('acf/format_value/type=wysiwyg');
          add_filter('acf/format_value/type=wysiwyg', 'acf_apply_content_filter_for_api', 10, 3);
       }
    }
    add_action('init', 'add_content_filter_ACF');

    It starts to work(let’s say) but the problem is the footnotes summary appears after every WYSIWYG field, and also it doesnt work fully properly.. I want it to only appear after all the contents of the post and summarize footnotes from all fields.

    somebody proposed a solution but i dont understand it and it doesnt work for me:
    https://support.advancedcustomfields.com/forums/topic/help-with-easy-footnotes-plugin-acf-wysiwyg/

    edit: if it’s unclear ill rephrase what im looking for:
    Is there a way to select all the output of ACF and apply a filter to it, treating it as a single field? or just select all the content of a wordpress post?

    I’m an amateur when it comes to core understanding of WP and PHP and it’s my second day of using ACF 😉

    thank you!

  • I fixed it. Fixes same problem with Table of content.

    I just add the fields i want to be parsed by the plugins to wordpress’ the_content() in my template.

    <?php 			
    add_filter('the_content','prepend_this');
    function prepend_this($content)
    {
        $content = get_field("some_field");
        return $content;
    }
    ?>
    <?php the_content(); ?>

    my site uses only ACF fields for content, so the_content() is always empty. Your results may vary.

    If something’s not clear, ask away.

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

The topic ‘Problem with Footnotes plugin and ACF Pro’ is closed to new replies.