• Resolved marcusjwilson

    (@marcusjwilson)


    Hi Jason – Lovely Plugin. Nice work.

    We are using the “PDF & Print” plugin by BestWebSoft to allow users to print and PDF posts from our site. The problem we have is that this plugin doesn’t output the Footnotes on a post to the PDF when it is created. I assume the plugin uses something other than the_content filters to output the post to PDF, and so your Footnotes aren’t inserted.

    The PDF & Print plugin allows us to add PHP output to the start/end of the PDFs that are created. So, is there a function in your plugin that we can use to manually call the Footnotes at the end of the post output?

    Any help much appreciated.

    Best wishes
    Marcus

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

    (@yingling017)

    Hi Marcus,

    There’s not anything that works perfectly for that at the moment. The code needs refactored a bit to allow for that to work better.

    The method that prints that out is easy_footnote_after_content(). I ran a quick test using the following code but I was getting a duplicate footnote. You can try it and it might work for you since you’re not getting any printed at all. Here’s the code:

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

    But no perfect solution at this time. Sorry!

    Thread Starter marcusjwilson

    (@marcusjwilson)

    Great stuff, Jason –

    Works perfectly for me, and only outputs the footnotes once.

    Thanks so much for looking into this.

    marcus

    I’m looking for a solution for this too. And I would like to try Jason’s code. But I haven’t succeeded. In which file should I insert the code? Where in the file (or doesn’t it matter?)? Should the code replace something else?

    I’m really a Noob. Thanks in advance for any hints.

    Thread Starter marcusjwilson

    (@marcusjwilson)

    Sure, Lunis –

    You would need to add a filter to change the content that is sent to the “PDF & Print” plugin by BestWebSoft, by adding the following code to your Theme’s functions.php file:

    /* Output footnote content after PDF and Print output */
    add_filter(
        'bwsplgns_get_pdf_print_content',
        function( $content ) {
    	
    	/* After content - add footnotes here */
    	global $easyFootnotes;
        	$after_content = $easyFootnotes->easy_footnote_after_content(get_the_content());
    
            /* returns the main content, with the footnotes below */
            return $content . $after_content;
        }
    );

    This worked for me.

    Best wishes
    Marcus

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Programmatic output of Footnotes?’ is closed to new replies.