I've have tried to make my first wordpress theme and I have some trouble with my single pages for my blog. [my blog page][1]
It is a custom post type, that I created called blog_post. The weird this seems to happen only when it is on a sublayer of my site ex. {url}/blog_post/ here the page looks just like my index page.
But on my work page there isn't any problem with my single pages, and their permalink doesn't have a {url}/work_post/ attach to them. [my work page][2]
I created the special styling of my single pages with functions.php file
define(SINGLE_PATH, TEMPLATEPATH . '/single');
/**
* Filter the single_template with our custom function
*/
add_filter('single_template', 'my_single_template');
/**
* Single template function which will choose our template
*/
function my_single_template($single) {
global $wp_query, $post;
/**
* Checks for single template by category
* Check by category slug and ID
*/
foreach((array)get_the_category() as $cat) :
if(file_exists(SINGLE_PATH . '/single-cat-' . $cat->slug . '.php'))
return SINGLE_PATH . '/single-cat-' . $cat->slug . '.php';
elseif(file_exists(SINGLE_PATH . '/single-cat-' . $cat->term_id . '.php'))
return SINGLE_PATH . '/single-cat-' . $cat->term_id . '.php';
/* <-------- if no single-cat page is found the return the single.php file
*/
elseif(file_exists(SINGLE_PATH . '/single.php'))
return SINGLE_PATH . '/single.php';
endforeach;
}
I hope someone can make sense of my mess :D