Support » Themes and Templates » Problem with template not showing correct page content

  • Resolved richF

    (@richf)


    Hi all,

    I’m still getting to grips with coding for WordPress and having a bit of a weird issue. I’ve created by own template to appear on the homepage of my website.

    As part of it, I’ve created a couple of new widget areas (which work fine). But in one of the areas I’ve put in the category posts widget – which returns a list of posts recently added to a defined category.

    This works, but once it’s finished it appears to have overwritten what was in the the_content() loop data and shows content from the last post pulled out of the category posts widget and displays that as the content to the page instead of the actual content.

    I’ve moved the loop to no avail – any help greatly appreciated!

    My template:

    if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    
    				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    					<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("image-banner-widget-area") ) : ?>
    					<?php endif; ?>
    
    					<div class="clr"></div>
    					<div id="homepage-container">
    
    <!-- This is where the category posts widget is shown on the page -->
    						<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("lhs-widget-area") ) : ?><?php endif; ?>
    
    						<div class="entry-content">
    
    <!-- The content of the page should appear here - but get the content from a post instead -->
    							<?php the_content(); ?>
    
    						</div><!-- .entry-content -->
    
    						<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("rhs-widget-area") ) : ?><?php endif; ?>
    
    						<div class="clr"></div>
    
    					</div>
    				</div><!-- #post-## -->
    
    				<?php comments_template( '', true ); ?>
    
    <?php endwhile; // end of the loop. ?>
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Problem with template not showing correct page content’ is closed to new replies.