Support » Fixing WordPress » page.php vs single.php

  • What is the purpose of each and how are they different from each other

    Please give an example of when I should use page.php and another of when I should use single.php


Viewing 8 replies - 1 through 8 (of 8 total)
  • single.php is the template for individual posts.

    page.php is the template for the new “Page” feature in 1.5.


    I need more clarification on this for WP 1.5 … I think the new page feature has the ability to allow the new pages to have their own theme defined, rather than only having themes swapped for the entire site through the presentation tab settings (style-switcher) … but I haven’t been able to make this happen …. yet! Looks like I need to set up page.php files in my themes folder … anyone might offer more detail?

    To restate … I’d like to be able to generate new pages, defining the theme for the new page …. not necessarily having the new page appear the same as whatever is set as the default theme per the presentation tab.


    OK, I’m starting to get it ….
    So, I can define a template for the page associated through the Write Page administration panel.
    Now if I want it to have a specific style associated with it … not the same as the style.css in that theme’s folder … I can define another XXX.css that I call in the page template. Right?

    You’d make my day if you’d push my nose in the typical template code where that is … and how to make it load a particular XXX.css file!

    Getting a little closer to success …after doing a good bit of digging. Initially I could only get the dropdown Page Template choice menu when using the WP1.5 default theme … found out that you had to make sure and give the template a name … AND that name has to be enclosed in php thingies:

    Template Name: xyz

    So, I’d probably be OK now, but I wanted to go to the next step of having the Page use it’s own template AND a different stylesheet.

    What I’m doing isn’t working … and I’m sure I’m not referencing the desired stylesheet correctly.

    If I have another stylesheet … xyz.css in a theme folder, how/what in the xyz.php invokes that stylesheet?

    Just need a little push folks … .



    Moderator Ryan Boren


    WordPress Dev

    Try something like this:

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/page.css" type="text/css" media="screen" />

    If you want to use the same header.php as the other templates, you’ll probably need to modify it to do something like this:

    <?php if (is_page()): ?>
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/page.css" type="text/css" media="screen" />
    <?php else ?>
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <?php endif; ?>

    If you want custom stylesheets for several differnet pages, you’ll need something like such:

    if (is_page('about-page')):
    // do stuff
    else if (is_page('links-page')):
    // do stuff
    // default stuff

    is_page() can accept a page id, a page name, or a sanitized URI-safe version of the page name.

    This worked!

    But, I think I’m trying toooooo hard to do something that I could just create two WP blogs to handle the what I want to do!

    Maybe the next rev will be more idiot friendly with setting up the page pieces.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘page.php vs single.php’ is closed to new replies.