ThemeShaper Forums » Thematic


Set up custom single.php

(5 posts)
  • Started 9 years ago by Mike_sa
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. Hi

    I am trying to set up a custom single.php file for a specific category.
    I understood that Thematic theme would look for a slug relating to the post first.

    The category slug is recent-projects . I have created the file single-recent-projects.php and have saved the file to the childtheme.

    When viewing a single post from this category it is not using the single-recent-projects.php file. I am only wanting to remove the sidebar for this category post and leave the side bar for all the other category posts.

    Am I supposed to activate the custom single file somehow?

    I have been trying all sorts of things now for hours and none work. I can't just comment the sidebar out in the main single.php file because I need it for other post categories.

    Help please :)

    Posted 9 years ago #
  2. i'm not sure what is going on w/ your template attempt. my guess (and i can't really see the diagram well at the codex) is that single pages just aren't supported in the way you are attempting.

    why not take the functions approach:

    Posted 9 years ago #
  3. I also would like to have different single.php for different categories. It seems like it can be done with something like this:

      $post = $wp_query->post;
      if (in_category('1')) {
      } elseif (in_category('2')) {
      } else {

    but I can't make it work.

    Posted 8 years ago #
  4. sowingseeds

    I suspect that TEMPLATEPATH relates to the Thematic directory not to the Child Theme directory?

    Posted 8 years ago #
  5. try:

    add_action('template_redirect', 'kia_template');
    function kia_template() {
    	if ( is_single() && in_category('foo'){
    		include (get_stylesheet_directory() . '/single-foo.php');
        } else if ( is_single() && in_category('bar') {
    		include (get_stylesheet_directory() . '/single-bar.php');
    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.