ThemeShaper Forums » Thematic

[closed]

Show new template on drop down when adding new page

(5 posts)
  • Started 3 years ago by ThetaHealer
  • Latest reply from helgatheviking
  • This topic is resolved
  1. I want to create a new template. I would like to know how to make it appear on the drop down list in Add New Page area of dashboard when creating new page. The list only has some templates and not all. I would like the choice to use my new template that I create.

    Thanks
    Peter

    Posted 3 years ago #
  2. Add this to the top of your template file

    /**
     * Template Name: My New Template Name
     *
     * This template allows is my new template
     *
     */
    Posted 3 years ago #
  3. Thank you. It is fine now.

    Posted 3 years ago #
  4. I understand the new template calls the stylesheet via the get_header(); but what if I want a different stylesheet than what is in the header. For example, I have a 3 column stylesheet layout being loaded for the homepage and a different stylesheet for the rest of the site by adding the following to my functions.php in my child theme:

    function my_stylesheet($content) {
        // We test if we're on home or on your frontpage
      if (is_home() || is_front_page()) {
        // yes, we are .. now let's load the 3c-fixed layout
            $content = "\t";
            $content .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"";
            $content .= get_bloginfo('stylesheet_directory') . "/style-home.css";
            $content .= "\" />";
            $content .= "\n\n";
      } else {
        // we are not .. let's load the 2c-r-fixed layout
            $content = "\t";
            $content .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"";
            $content .= get_bloginfo('stylesheet_directory') . "/style.css";
            $content .= "\" />";
            $content .= "\n\n";
        }
            // $content will be handed back to thematic_create_stylesheet
        return $content;
    }
    // connect the filter to thematic_create_stylesheet
    add_filter ('thematic_create_stylesheet', 'my_stylesheet');

    and I have defined a 2c-r-fixed.css for all other pages in the site (above) for the default drop down.

    However, I want to have the option to assign yet another layout (2c-l-fixed.css) to a page (not necessarily a post at this point) so they can select the "Two Column Left" [or whatever I name it] from the drop down.

    I'm confused about assigning a different layout as a drop down option. I pretty much understand add the function like above to assign a stylesheet to a front page or category etc.

    Can someone point me in the right direction?

    Posted 2 years ago #
  5. if i understand you correctly you'd just add another condition to what you have above

    elseif (is_page_template('your-templates-name.php')){
    $content = "\t";
            $content .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"";
            $content .= get_bloginfo('stylesheet_directory') . "/style-left-column.css";
            $content .= "\" />";
            $content .= "\n\n";
    }

    or you could just apply the different layout w/ dynamic body classes and specificity

    .your-templates-name-php #content {
      background: pink;
    }
    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.