• Resolved matthewordie

    (@matthewordie)


    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 ‘Plugin Views (includes and ob_start)’ is closed to new replies.