Support » Plugin: Easy Footnotes » Manual placement of Footnotes in single.php

  • Trippetchz

    (@trippetchz)


    Hi there,

    Thanks for a great plugin!

    I know you’ve been asked questions like this before, and I’ve read other posts about somewhat similar questions, but I’d like to specify in my theme precisely where the footnotes are displayed.

    I’d like to not have the footnotes list included in the_content(); so I can specify where they appear in my theme’s single.php. Would this be possible to hack?

    The closest I can get to displaying just the footnotes list is by using this hook below as mentioned here:

    <?php
        global $easyFootnotes;
        echo $easyFootnotes->easy_footnote_after_content(the_content());
    ?>

    Unfortunately, the problem with that is that the footnote list also obviously includes the_content(); too, which is undesirable, because now we have duplicate output.

    Is there a way to call the easy_footnote_after_content() function without returning the_content(); too? Just the footnotes list?

    I notice the string $efn_output in the easy_footnote_after_content() function has exactly what I want in it. But how do I get that into single.php?

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jason Yingling

    (@yingling017)

    There’s not currently a great way to do it. It would probably need to be refactored to build the $efn_output from a separate function that gets passed the_content. Since as you noted the easy_footnote_after_content() function returns the_content with the $efn_output data appended.

    I’ll add it to the list of features, but if you’d like to take a whack at it too Easy Footnotes is on github at https://github.com/yingles/easy-footnotes.

    Hi Jason,
    Thanks for this plugin, it’s the best I’ve found. I’m hoping to remove the_content from the output. It’s not elegant I know but could you suggest a workaround that might be something like this (note this code doesn’t work, not sure why though I don’t know PHP at all):

    global $post;
    $theContent = get_the_content($post->ID);
    
    global $easyFootnotes;
    $efnWithContent = $easyFootnotes->easy_footnote_after_content(the_content());
    $efnWithoutcontent = trim(str_replace($theContent,'',$efnWithContent));
    
    echo $efnWithoutContent;

    Hopefully this is at least understandable as an idea and you can let me know whether this solution is workable.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.