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?

1 Answer 1


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' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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