Hooking custom PHP output into WP: how to do it, parse_request almost works but not quite

The two most common ways to add in such Plugin output directly into the template are:

  1. Use a Theme-provided action hook
  2. Instruct the user to add a Plugin function call manually into the template

Some, though not many, Themes provide custom action hooks in the template, that you could use to output your Plugin content.

For example, in my Oenology Theme, I have a oenology_hook_loop_before action hook, that you could use, like so, within your Plugin:

<?php
function wpse44952_add_loop_before_hook() {
    myPluginFunc();
}
// Hook into Oenology template
add_action( 'oenology_hook_loop_before', 'wpse44952_add_loop_before_hook' );
?>

Note, though, that such hooks aren’t standardized. Any Theme that provides such hooks will use its own naming convention. So, you’d have to add add_action() calls for every such Theme that you want to support.

The other common method is simply to ask users to add myPluginFunc() manually into the template, wherever it needs to be output. While sub-optimal, end users are also fairly used to doing this with other Plugins (e.g. WP PageNavi).