WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wp not outputing whole of template (5 posts)

  1. intothewhite
    Member
    Posted 5 years ago #

    Hi,

    I have an about page that uses a template I have created. The template is called about.php

    For some reason, the template isn't outputting the whole page (my test page).

    Here's my about.php file:

    <?php
    /*
    Template Name: About
    */
    ?>
    
    <?php get_header(); ?>
    
    <?php while (have_posts()) : the_post(); ?>
    
    	<?php $banner_text = get_post_meta($post->ID, 'banner_text', true); ?>
    
    	<div id="leader">
    
    		<h2><?php echo $banner_text; ?></h2>
    
    	</div>
    
    	<div id="content">
    
    		<?php the_content(); ?>
    
    <?php endwhile; ?>
    
    		<div id="extras">
    
    			<h3>From the blog</h3>
    
    			<h3>Stuff from the web I&apos;ve bookmarked</h3>
    
    		</div>
    
    	</div>
    
    <?php get_footer(); ?>

    As you can see, the content of the extras div isn't being displayed. The extras div is separate because I'm going to use a couple of plugins there.

    Thanks,

    Leon

  2. Evita
    Member
    Posted 5 years ago #

    Found this error in the stylesheet of this page, so it canĀ“t work:
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>404 Not Found</title>
    </head><body>
    <h1>Not Found</h1>
    <p>The requested URL /test/front/style.css was not found on this server.</p>
    <p>Additionally, a 404 Not Found
    error was encountered while trying to use an ErrorDocument to handle the request.</p>
    <hr>
    <address>Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.7a DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at intothewhite.co.uk Port 80</address>
    </body></html>

  3. intothewhite
    Member
    Posted 5 years ago #

    Thanks for replying.

    You've found an unrelated problem: I hadn't got rid of the reference to the stylesheet I was using when it was a static, mockup page. I've done that, but the problem persists — unsurprising, as a missing stylesheet wouldn't cause bits of the page to be displayed and others not.

    It's a bit of an odd problem.

    — Leon

    `

  4. intothewhite
    Member
    Posted 5 years ago #

    I've figured out the problem (although it's not solved).

    For some reason, the page uses page.php as its template, not about.php. In wp-admin the page has been told to use About as its template (Manage - Page - Advanced - Page Template - About).

    I'm guessing this is a problem with the database?

  5. intothewhite
    Member
    Posted 5 years ago #

    It seems that calling the template file about.php and the page About causes a problem. Renamed the file (rather than the template) and everything's fine.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags