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 my site I have a blog where each posts loads single.php like normal wordpress installation. I also have a "shop" custom page where each links also loads single.php but the permalink is different. For normal blog post the permalink goes like this:


For custom shop page the permalink goes like this:


What I am trying to do is not load default single.php when clicking on individual post from shoppage template. I want to load a custom single.php with my own changes added. Is it possible?

Relevant part for index.php:

    <h2 class="post_title">
                            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                        <!-- /.post_title -->

<div class="post_meta">
                            <?php echo __('Posted on ', 'wizy') . get_the_date(); ?> <?php _e('in ', 'wizy'); echo the_category(', ');?> by <?php the_author(); ?>

                        <!-- /.post_meta -->

relevant part from shoptemplate.php:

<div class="project_container">

<center><h2 class="post_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2></center>

                            <a href="<?php echo $thumb_src[0]; ?>" class="project_thumb zoom">
                            <?php if( has_post_thumbnail() ) : ?>
                                <?php the_post_thumbnail('project_thumb_midd'); ?>
                            <?php else : ?>
                                <img src="<?php echo TIMTHUMB; ?>?src=<?php wizy_assets_uri(); ?>/images/image_placeholder.png&amp;w=300&amp;h=250&amp;zc=1" alt="<?php the_title(); ?>">
                            <?php endif; ?>
                            <!-- /.post_thumb -->

                            <div class="project_desc">
                                <?php the_content('',FALSE,''); ?>

                            <!-- /.post_excerpt -->

                            <?php if( $pos = strpos( $post->post_content, '<!--more-->') ) : ?>
                                <a href="<?php the_permalink(); ?>" class="more_link"><?php _e( 'View Project &rarr;', 'wizy' ); ?></a>
                            <?php endif; ?>


I know my way around with wordpress, but not so much with php

share|improve this question
are the shop posts a custom post type? – Milo Jul 3 '12 at 4:17
up vote 3 down vote accepted

This should help, if you need more info: http://codex.wordpress.org/Template_Hierarchy

Simply put, Wordpress looks for template files in the following order for single posts:

  • single-{post_type}.php,
  • single.php,
  • index.php.

If you want to override the standard single.php file, that's how (for a custom post type only, as you're using)

share|improve this answer
Your answer is much better than mine. I will select it as the answer. – bran Jul 3 '12 at 5:34

Found it. Just create another single.php as single-shoppage.php and it should load the new php. have to do nothing else. Just edit single-shoppage.php to see changes to that post type.

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.