WordPress.org

Support

Support » Plugins and Hacks » Hacks » [Resolved] Plugin Views (includes and ob_start)

[Resolved] Plugin Views (includes and ob_start)

  • I’m creating my first plugin and I’d like to setup some simple view templates for my front end.

    Currently I’m trying something like:

    $title = 'Title';

    // Start a buffer
    ob_start();
    // Include your template
    include('template.php');

    // Get the buffer into a variable
    $return = ob_get_contents();

    // End the buffer
    ob_end_clean();

    This gets the template just fine, but my $title variable does not carry over into the include like usual. This code works fine outside of the constructs of WP. Any idea what might be causing it?

  • The topic ‘[Resolved] Plugin Views (includes and ob_start)’ is closed to new replies.
Skip to toolbar