Home › Forums › Backend Issues (wp-admin) › Help with Easy Footnotes Plugin + ACF WYSIWYG
I’m having some issues getting a plugin called Easy Footnotes to work correctly with ACF, and was hoping to see if anyone might be able to help.
After some research on the ACF forum, I was able to get the footnotes to appear on the front end by implementing this code snippet:
add_filter(‘acf/format_value/type=wysiwyg’, ‘format_value_wysiwyg’, 10, 3);
function format_value_wysiwyg( $value, $post_id, $field ){
$value = apply_filters( ‘the_content’, $value );
return $value;
}
However, my issue now is that I have multiple WYSIWYG fields on my pages, and the footnotes are currently outputting to all fields that has a WYSIWYG field editor, creating repeated footnotes across the page. I’m trying to isolate the footnotes to just to one of the WYSIWYG field editor. The field that it should only be outputted to in ACF is called ‘publication_content’. I’m wondering if there is a way to only call out this function on that particular field ( get_field(‘publication_content’ )?
I’m in the process of learning WordPress and PHP, and would greatly appreciate any guidance!
This was also an issue that appeared in this forum back in 2016: https://support.advancedcustomfields.com/forums/topic/foot-notes-within-acf/
I contacted support and was able to resolve the issue. What I needed to reference was the api-value.php file starting from line 293 in the plugin folder. This pointed me to how I can target the specific field name to make the footnotes work. Updated code (changes in bold):
add_filter(‘acf/format_value/name=publication_content‘, ‘format_value_wysiwyg’, 10, 3);
function format_value_wysiwyg( $value, $post_id, $field )
{
$value = apply_filters( ‘the_content’, $value );
return $value;
}
hey so i found this code:
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');
and i was trying to subsitute
remove_all_filters('acf/format_value/type=wysiwyg');
for
remove_all_filters('acf/format_value/name=publication_content');
but the substitution doesnt work. can someone help me and tell me how should i modify the code? Footnotes are crucial to my website. thanks
PS oh, i see the thread is closed, should I start a new thread?
The topic ‘Help with Easy Footnotes Plugin + ACF WYSIWYG’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.