• So I made a couple page templates that do some special queries of my DB like this:

    <?php
    /*
    Template Name: Newstemp
    */
    ?>
    <?php get_header(); ?>
    <table width="100%" style="border:1px solid #cccccc;" cellpadding=4 cellspacing=0><tr><td bgcolor="#ffffff">
    <table border="0" cellspacing="0" cellpadding="1" align="left">
    <tr>
    <td>
    <h2 align="center">The Newsroom</h2>
    <table width="100%" border="0" cellspacing="0" cellpadding="5">
    <tr bgcolor="#CCCCCC">
    <td align="center"><strong>Homework</strong></td>
    </tr>
    <tr>
    <td valign="top"><?php query_posts('category_name=News&showposts=30'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <a class="titleLink" href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
    <?php _e("Posted on "); ?>
    <?php the_time('m.d.y',display); ?> at <?php the_time() ?>
    <br>
    <div class="storycontent">
    <?php the_content(); ?>
    </div>
    <p class="newsmeta">
    <?php edit_post_link('Edit','','|'); ?>
    <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?><?php endwhile;?></p></td>
    </tr>
    </table>
    <br><div id="content">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="storycontent">
    <?php the_content(); ?>
    </div>
    <br><?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    </td></tr></table>
    <?php endwhile; endif; ?>

    </td>
    </tr></table>
    <?php get_footer(); ?>

    But instead of showing up in the little pulldown on the page in the admin panel where you specify which template you want to use, this is displaying all of its html directly under that pulldown, and I can’t select it. https://www.badcharacter.com/page.jpg

    Can anyone spot what I’m doing wrong here?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Probably text editor that you use.

    Try adding links.php and archives.php templates from Default Theme. If they work then start off with one of those file: rename template name and fill in your content.

    I think whenever you see a lot of html or css where it does absolutely NOT belong, it’s because an area which should be commented has a problem….

    Try taking out the whitespace in your commented area for starters.

    Thread Starter axo1ot1

    (@axo1ot1)

    I tried making a file that uses the example code for a template from the codex:

    https://codex.www.ads-software.com/Pages#Examples_of_Pages_and_Templates

    I am having the same problem. Then I tried just duplicating my basic page.php file and renaming it and changing the template name in the file. This produced an interesting result: When the page.php file and page2.php were both in the theme’s directory at the same time, only page.php displayed in the pulldown and page2.php did what the template in my first post did. But if I took page.php out of that directory, page2.php displayed fine. Am I only allowed to have one theme? Is there something in the file that’s causing the pulldown to cut off or something? Here’s the code from page.php:

    <?php
    /*
    Template Name: Fuck You and Die
    */
    ?>
    <?php get_header(); ?>
    <table width="100%" style="border:1px solid #cccccc;" cellpadding=4 cellspacing=0><tr><td bgcolor="#ffffff">
    <table border="0" cellspacing="0" cellpadding="1" align="left">
    <tr>
    <td>
    <div id="content">

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="storycontent">
    <?php the_content(); ?>
    </div>
    <br><?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    </td></tr></table>
    <?php endwhile; endif; ?>

    </div>
    </td></tr></table>
    <?php get_footer(); ?>

    Thread Starter axo1ot1

    (@axo1ot1)

    Anyone? Anyone? Bueller?

    For the default Page template, aka page.php you don’t have to put those lines at the top (regarding template name and such) – it is recognized by WP just by its name.
    For all the other Page templates use the lines:
    <?php
    /*
    Template Name: Whatever
    */
    ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Templates Not In Pulldown’ is closed to new replies.