Solution:
All WordPress functions are available in a plugin. The matter is hooking in the right place.
Simple example:
<?php
/**
* Plugin Name: Test Plugin
*/
// This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated
add_action( 'wp_loaded', 'plugin_so_18538270' );
function plugin_so_18538270()
{
// Admin area, do nothing
if( is_admin() )
return;
// "true" == $var
// See Yoda Conditions: http://www.codinghorror.com/blog/2012/07/new-programming-jargon.html
if( isset( $_GET['print'] ) && "true" == $_GET['print'] )
{
// some code
exit();
}
}
References:
- Writing_a_Plugin and Plugin_API at the Codex.
- Highest voted Questions in the <Plugin-Development> tag at WordPress Answers.