WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Joomla! articles can use multiple templates. I could only put ath the end of url ?template=templatename and article uses the template "templatename".

Is this possible in Wordpress?

share|improve this question
up vote 2 down vote accepted

Yes it is. But no by default.

But it's pretty easy to do it yourself.

You can do it in 2 ways:

1. In single.php template file

Just add if statement and use get_template_part function to load selected template.

So your single.php file could look like this:

if ( isset($_GET['template']) ) {
    switch ($_GET['template']) {
        case 'a':
} else {

2. Using single_template hook.

function get_custom_post_type_template($single_template) {
     global $post;

     if ($post->post_type == 'post' && isset($_GET['template']) ) {
          switch ( $_GET['template'] ) {
               case 'a':
                   return locate_template( array('/single-post-template-a.php') );
     return $single_template;
add_filter( 'single_template', 'get_custom_post_type_template' );
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.