WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] My page template isn't pulling the loop (2 posts)

  1. BrianHolcombe
    Member
    Posted 4 years ago #

    Hello,

    I am developing a site within the Atahualpa theme that uses the loop multiple ways between a few pages. One of those pages, the one below, should contain the full loop. I've created a template for the page, yet the page is not pulling the loop.

    As an aside, advice on hiding the date and time for the page (while maintaining date and time on posts) would be greatly appreciated.

    The url is http://themountainshop.com/blogcenter

    The template code reads:

    <?php
    /*
    Template Name: blogcenter
    */
    ?>
    
    <?php 	/* get all options: */
    include (TEMPLATEPATH . '/functions/bfa_get_options.php');
    get_header(); ?>
    
    <img src="http://themountainshop.com/wp-content/uploads/2009/10/blogcenter.header.png">
    
    <!-- Start the Loop. -->
     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
     <!-- Display the Title as a link to the Post's permalink. -->
     <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    
     <!-- Display the Time. -->
     <small><?php the_time('F jS, Y'); ?></small>
    
     <!-- Display the Post's Content in a div box. -->
     <div class="entry">
       <?php the_content(); ?>
     </div>
    
     <!-- Display a comma separated list of the Post's Categories. -->
     <p class="postmetadata">Posted in <?php the_category(', '); ?></p>
     </div> <!-- closes the first div box -->
    
     <!-- Stop The Loop (but note the "else:" - see next line). -->
     <?php endwhile; else: ?>
    
     <!-- The very first "if" tested to see if there were any Posts to -->
     <!-- display.  This "else" part tells what do if there weren't any. -->
     <p>Sorry, no posts matched your criteria.</p>
    
     <!-- REALLY stop The Loop. -->
     <?php endif; ?>
    
    <?php bfa_center_content($bfa_ata['center_content_bottom']); ?>
    
    <?php get_footer(); ?>

    Thanks in advance!

    Brian

  2. BrianHolcombe
    Member
    Posted 4 years ago #

    Updated:
    I've changed the template code and have hidden the date and time, but still no loop. The code is copied from my index.php template, which displays the loop on the homepage, yet no loop on the blogcenter page.

    <?php
    /*
    Template Name: blogcenter
    */
    ?>
    
    <?php 	/* get all options: */
    include (TEMPLATEPATH . '/functions/bfa_get_options.php');
    get_header(); ?>
    
    <img src="http://themountainshop.com/wp-content/uploads/2009/10/blogcenter.header.png">
    
    <?php /* If there are any posts: */
    if (have_posts()) : $bfa_ata['postcount'] == 0; /* Postcount needed for option "XX first posts full posts, rest excerpts" */ ?>
    
    	<?php /* This outputs the next/previous post or page navigation.
    	This can be edited at Atahualpa Theme Options -> Style & edit the Center column */
    	bfa_center_content($bfa_ata['content_above_loop']); ?>
    
    	<?php /* The LOOP starts here. Do this for all posts: */
    	while (have_posts()) : the_post(); $bfa_ata['postcount']++; ?>
    
    		<?php /* Add Odd or Even post class so post containers can get alternating CSS style (optional) */
    		$odd_or_even = (($bfa_ata['postcount'] % 2) ? 'odd-post' : 'even-post' ); ?> 
    
    		<?php /* This is the actual WordPress LOOP.
    		The output can be edited at Atahualpa Theme Options -> Style & edit the Center column */
    		bfa_center_content($bfa_ata['content_inside_loop']); ?>
    
    	<?php /* END of the LOOP */
    	endwhile; ?>
    
    	<?php /* This outputs the next/previous post or page navigation and the comment template.
    	This can be edited at Atahualpa Theme Options -> Style & edit the Center column */
    	bfa_center_content($bfa_ata['content_below_loop']); ?>
    
    <?php /* END of: If there are any posts */
    else : /* If there are no posts: */ ?>
    
    <?php /* This outputs the "Not Found" content, if neither posts, pages nor attachments are available for the requested page.
    This can be edited at Atahualpa Theme Options -> Style & edit the Center column */
    bfa_center_content($bfa_ata['content_not_found']); ?>
    
    <?php endif; /* END of: If there are no posts */ ?>
    
    <?php bfa_center_content($bfa_ata['center_content_bottom']); ?>
    
    <?php get_footer(); ?>

    Brian

Topic Closed

This topic has been closed to new replies.

About this Topic