views:

16

answers:

1

in wordpress the single page is controlled by single.php theme file. I want to put another link on the single page like "Preview". I want this link to be handled by preview.php. preview.php will be stored in theme directory! how to handle this?

usually I do these using init action hook! if the variable exists in the query string, I perform the action! but how to register a custom script to handle a custom link!

the single page link is like ?p=x and the link to preview will be ?p=x&action=preview

thanks in advance

A: 

You could do it old school style. At the very top of your single.php, put:

<?php
if( isset( $_GET['preview'] ) ) {
  require( "preview.php" );
  die(); # a horrible death
}
?>
pp19dd
thanks for your input! yes, this is the last option I have in my mind! anything more decent?
HungryCoder