I'd recommend using the template_include filter as opposed to template_redirect, as using this hook means that you don't redirect the user but rather just present them with the template that is requierd.

add_filter('template_include', 'my_custom_template_redirect', 99);
function my_custom_template_redirect($template){

    global $post;

    if(is_single() &amp;&amp; 'campaign' == get_post_type($post)){
        $page_template = get_page_template();
        $new_template = locate_template( array( 'subfolder/' . $page_template . '.php' ) );
        $template = ($new_template !== '') ? $new_template : $template;
    }

    return $template;

}


Ovbiously I'm making the assumption that your $page_template variable doesn't have .php on the end, but you can ammend that as required.

I'd recommend you have a read of the documentation related to this hook, and the locate_template function -


template_include filter hook - http://codex.wordpress.org/Plugin_API/Filter_Reference/template_include
locate_template() - http://codex.wordpress.org/Function_Reference/locate_template


Update

In my original answer I forgot to include global $post;. I've now amended the answer to include this line.

Custom Post Type with Templates using Meta Boxes?
So this might sound like a crazy question but bear with me for a minute. I can't find any info on the internet and so am here, although this might have been a good place to start.

I've recently developed an encryption engine using the .net's AES managed classes. I use a 256 bit key generated by the Rfc2898DeriveBytes function. The key is generated from a pass phrase that is at least 40 characters long. The IV is also generated from this pass phrase. The encryption class uses a CypherMode of CBC and a padding mode of PKCS7. There is a static salt that is 8 bytes long. 

The key is stored in a separate database to the data and is itself encrypted using a certificate based on the database master key.

So, my question is: is it really easy to decrypt the data if the attacker has the key? I'm not talking about the Chinese government (or even GHCQ given recent headlines), I'm talking about an attacker who steals both databases. 

What would be the steps they have to follow and/or how can I stop them on their path? The reason I ask this is that I want to know how feasible it is. Is it something that can be done in minutes or does it fall into the bracket of being infeasible? Do they have to calculate all of the parameters used when encrypting?
