• Okay, first of all, here’s how my WordPress site works:
    I’m one of those weird template system fanboys, and I have an obsession with splitting visual stuff from any kind of back-end logic. So, all the HTML for my website is in Smarty templates, and my WordPress theme basically grabs information from the back-end (as necessary) and passes it to the templates.

    This means all of the processing happens before any of the rendering: if anything gets printed, it appears at the very top of the document and results in an invalid page. Which breaks any web browser that feels such foolishness should not be tolerated. (Surprisingly enough, that is only Internet Explorer).

    Now, for a while I was using the_content() and output buffering to get post content. That prints it, but PHP catches the printed output and stores it in a variable instead. Kinda silly.

    I switched that to use get_the_content. When I did that, this happened…

    https://www.dylanmccall.com/contact/

    If you look at the source you’ll see, at the very top of the file:

    <link rel=’stylesheet’ id=’grunion.css-css’ href=’https://www.dylanmccall.com/wp-content/plugins/grunion-contact-form/css/grunion.css?ver=3.3.1&#8242; type=’text/css’ media=’all’ />

    Normally that appears right above the contact form.

    Two things here:
    This shouldn’t be printed the way it is, because it screws up anyone who uses get_the_content.
    Can you use register_style and enqueue_style for this? I think it’s a little cleaner.

    Thank you for the great plugin! It works really well ??

    https://www.ads-software.com/extend/plugins/grunion-contact-form/

Viewing 1 replies (of 1 total)
  • Thread Starter Dylan McCall

    (@picklesworth)

    Okay, I went ahead and fixed this on my end by changing grunion-contact-form.php, line 26, from wp_print_styles( 'grunion.css' ); to wp_enqueue_style( 'grunion.css' );

    So, the Contact page I linked to won’t have the problem I described. Here’s what its HTML looked like at the top, though, to be clear:

    <link rel='stylesheet' id='grunion.css-css'  href='https://www.dylanmccall.com/wp-content/plugins/grunion-contact-form/css/grunion.css?ver=3.3.1' type='text/css' media='all' />
    <!DOCTYPE html>
    <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <title>Contact  |   Dylan McCall</title>

    With the change I made, the doctype tag is back at the top of the file and the grunion.css link is in wp_footer.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Grunion Contact Form] Grunion appears to be printing stuff when it should be returning it’ is closed to new replies.