Roots + FPDF

So I’m knee deep in developing a site for a local chiropractor business and I realize that I need a great Gift Certificate PDF generating tool. Enter FPDF and I tested the plugin on TwentyFourteen and it works great! The issue is that that it keeps throwing an error at me when I use the Roots theme.

FPDF error: Some data has already been output, can't send PDF file (output started at /home/eternalw/public_html/blmc/wp-content/themes/blmc/templates/head.php:2)

So my next step was to take a closer look at the code… I’m now 3 hours in and still scratching my head. My best guess is that it’s something with the template hierarchy and that Roots doesn’t play nice with FPDF.

Has anyone else had this issue? Did anyone solve this issue? Any help at all would be super appreciated! :smiley:

It will be the wrapper causing the issue.

Does the plugin have its own conditional or use a custom post type? If so you can test with/for that and opt-out the wrapper with the roots_wrap_base filter.

Thank for the reply, man! I did just that. I read your article again in more detail about the wrapper and used the filter wrap you suggested. After that I axed everything in the base with the except of <?php include roots_template_path(); ?>

Super helpful! Thanks a ton!