Viewing 15 replies - 1 through 15 (of 23 total)
  • Thread Starter hughlicious

    (@hughlicious)

    Anyone? Please?

    Thread Starter hughlicious

    (@hughlicious)

    Trying to bump this one last time, but I guess noone can/wants to help me.

    Thread Starter hughlicious

    (@hughlicious)

    Bumping this again, since I still have the problem and am hoping that with spring having finally started, people might be a bit more helpful. ??

    Does the theme you are using have a Page template?

    You can’t really do anything with _wp_page_template. If you had templates to choose from, they’d appear in the Page Template menu.

    As for the permalink, have you updated .htaccess or is WP able to update it? (the permissions should be 666, that is read-write for all (or just you and other, that is 646))

    Hughlicious – the reason you have not had an answer is that because we are newly at 1.5 this q would be fairly considered to be at the high end of web dev. As I understand it you need to create a template first. Then as you create the page you can associate the template in the drop down.

    Thread Starter hughlicious

    (@hughlicious)

    I tried with the default theme. It comes with page.php, that’s what is needed right? It still doesn’t display in the drop down though. ??
    .htaccess? I have an empty one in my main folder, is that what you mean?
    Sorry, I’m really quite clueless about this all. :/

    For Permalinks to work, you need to allow WP write in your .htaccess (it should be in the blog’s root/main folder where you have it). You don’t have permalinks enabled at the moment (because your posts are referred to as “?post=x”) so unless you *insist* on having the tidy page links, you don’t have to turn permalinks on at all.

    page.php (the Page template) is used, if found, when pages are viewed. You don’t *need* it but it’s easy to customise pages with it as often you don’t want comments and things on the pages.

    It’s not a page template as such, just similar to post template, archive template, main template. It’s used in the correct context.

    Page templates have a
    <?php
    /*
    Template Name: My page
    */
    ?>

    declaration at the beginning and *they* show up in the dropdown.
    If you want to remove those things you mentioned from ALL your pages (current and upcoming), it’s easiest to make a page template: you create a page.php file and put it on your theme’s folder.

    I know this reply is getting long, but here’s a cleaned up version of my page template, in case it helps at all. This you would save as page.php and put in the correct theme folder:
    <?php get_header(); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post">
    <h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    <div class="meta">
    <?php edit_post_link(); ?>
    </div>
    <div class="storycontent">
    <?php the_content(); ?>
    </div>
    </div> <!-- post -->
    // this is to show how I enable comments only
    // on my feedback page
    <?php if (is_page('feedback')) { ?>
    <?php comments_template(); ?>
    <?php } ?>
    <?php endwhile; else: ?>
    <?php _e('Sorry, page not found.'); ?>
    <?php endif; ?>
    <?php get_footer(); ?>

    Maybe with the help of that you can build up the page your your dreams…. ?? I’ll be happy to help with the rest of the “tweaking”. (as some of the things you want “deleted” aren’t controlled with page.php)

    Minna am I right in saying that templates other than the pre installed like page.php need to be plugins ? Or can we name something like your template above as anything we like (barring WP names of course) and it will work ?

    The template can be named anything you want – for example I constructed a template called gordon.php but use it for the purposes of your about page – what you call your template I don’t think really matters, but for reasons of organisation and understanding, it’s usually a good idea to name them what you will use them for. YOu can then use that same template for several different pages.

    For example, say you create an about page and create a template for it, you name that page about bob – you can then decide to add another page called about sue using that same template. Or use it for something completely different.

    Root, I’m not sure how to interpret plugin in that context, but as to the 2nd quesion: yes, you could make a file anythingyoulike.php, put it in your theme folder, and it would be available to be used on pages. The archives (where you see month and category) in default theme (I know you don’t use it…. ?? ) are actually made as a “user-made page template”.

    You’d need to include that little “declaration” as the first thing of the template and then it would show up in the dropdown

    I hope I’m making some sense…

    and just to add page.php is just the name of a template with a theme, some themes I found to even come with templates so you just make your own or copy and paste an existing template – I’ve found them to be really flexible, particularly if using the same template for several things.

    And this will work even if your new template new.php is not associated with a page – or can you call it from another template using get_new ()

    I don’t think get new would work, but you could use

    <?php load_template( TEMPLATEPATH . '/new.php'); ?>

    instead which would work, and place that in the top of whatever file you want to call it to. Or create the file and then create a page and set it to use that template as the page.

    Ah. That was what I needed. Thanks.

    You can create as many Page templates as you want, and they all will show up in the dropdown options on the Write Page panel at Page Option > Page Templates. (The one named Default Template = your page.php in your theme!)
    For filenames you can use almost anything (anything.php ?? except these 2 lists – those files having a special meaning in WP.

    In Dark Maple I wanted to have a page to display the searchform, so I created a file, named searchpage.php (since search.php is reserved for the search results template!), put on the top:
    <?php
    /*
    Template Name: Search
    */
    ?>

    though I could write here anything instead of “Search”… and it has the usual get header, footer, sidebar etc. calls, plus in the content div this:
    <?php include (TEMPLATEPATH . '/searchform.php'); ?>
    When I was done with the template + uploaded, I went to create a new Page, did NOT write anything in it, just selected as template “Search” from the options given, clicked… and voila! Then I checked its ID in the Manage Pages section and hardcoded the page_id link in the horizontal menu.

    I hope it makes sense ??

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘Page template question’ is closed to new replies.