WordPress.org

Ready to get started?Download WordPress

Forums

Blog Page Showing Page Name (13 posts)

  1. efpeterson
    Member
    Posted 1 year ago #

    Hi folks,

    I'm working on a theme that one of my clients bought and I'm having a hard time. They wanted the home page and the blog to be the same, so naturally I copied the index.php file and created a blog template out of it. For some reason the loops aren't working on the blog page and they are just showing the page name as a category but not any of the posts. You can see the blog page preview here: http://tinyurl.com/br8efzw

    I don't understand what I did wrong. Any thoughts?

  2. Webstractions
    Member
    Posted 1 year ago #

    Try publishing the page first. We can't view your "preview only" pages.

  3. efpeterson
    Member
    Posted 1 year ago #

  4. efpeterson
    Member
    Posted 1 year ago #

    It will show content published on that page, but there are no posts. Does it think the category is that page for some reason?

  5. nickkos
    Member
    Posted 1 year ago #

    Make sure that your

    <?php the_title(); ?> is after the loop start.

  6. efpeterson
    Member
    Posted 1 year ago #

    There's no <?php the_title(); ?> in the page at all. It's in the header so it seems.

  7. nickkos
    Member
    Posted 1 year ago #

    change the loop on this page to a default loop...

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    Make sure that between

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    INSERT YOUR POST THEMING CODE HERE

    <?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>
  8. efpeterson
    Member
    Posted 1 year ago #

    Not sure I have anything that looks like that. The page code is as follows:

    <?php
    /*
    Template Name: Blog
    */
    ?>
    
    <?php get_header(); ?>
    		<div id="main" class="clearfix">
    		<div id="content" class="full clearfix twoThird">
    			<?php $c=0; $post_count = $wp_query->post_count; ?>
    			<?php  while (have_posts()) : the_post(); ?>
    			    <?php $c++; ?>
    			    <?php $postClass = has_post_thumbnail() ? $postClass = "withThumb" :  $postClass = ""; ?>
    				<?php $postClass = $c == $post_count ? $postClass = $postClass." lastPost" :  $postClass = $postClass; ?>
    				<div class="post clearfix <?php echo $postClass; ?>">						
    
    						<?php if(has_post_thumbnail()) : ?>
    					    		<a href="<?php the_permalink() ?>" rel="bookmark" ><?php the_post_thumbnail('ttrust_small', array('class' => 'postThumb', 'alt' => ''.get_the_title().'', 'title' => ''.get_the_title().'')); ?></a>
    						<?php endif; ?>
    						<div class="inside">
    							<div class="metaCat"><?php _e('In', 'themetrust'); ?> <?php the_category(', ') ?></div>
    							<h1><a href="<?php the_permalink() ?>" rel="bookmark" ><?php the_title(); ?></a></h1>
    							<div class="meta clearfix">
    								<?php _e('Posted by:', 'themetrust'); ?> <?php the_author_posts_link(); ?> <?php _e('on', 'themetrust'); ?> <?php the_time( 'M j, Y' ) ?> | <a href="<?php comments_link(); ?>"><?php comments_number(__('No Comments', 'themetrust'), __('One Comment', 'themetrust'), __('% Comments', 'themetrust')); ?></a>
    							</div>
    							<?php $content = get_the_content(''); ?>
    							<?php $content = apply_filters('the_content', $content); ?>
    							<?php echo wpt_strip_content_tags($content); ?>
    							<?php more_link(); ?>
    						</div>
    			    </div>				
    
    			<?php endwhile; ?>
    
    			<?php include( TEMPLATEPATH . '/includes/pagination.php'); ?>
    		</div> <!-- end content -->
    
    		<?php get_sidebar(); ?>
    		</div>
    
    <?php get_footer(); ?>
  9. nickkos
    Member
    Posted 1 year ago #

    Try this `<?php
    /*
    Template Name: Blog
    */
    ?>

    <?php get_header(); ?>
    <div id="main" class="clearfix">
    <div id="content" class="full clearfix twoThird">
    <?php while (have_posts()) : the_post(); ?>
    <?php $c++; ?>
    <?php $postClass = has_post_thumbnail() ? $postClass = "withThumb" : $postClass = ""; ?>
    <?php $postClass = $c == $post_count ? $postClass = $postClass." lastPost" : $postClass = $postClass; ?>
    <div class="post clearfix <?php echo $postClass; ?>">

    <?php if(has_post_thumbnail()) : ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" ><?php the_post_thumbnail('ttrust_small', array('class' => 'postThumb', 'alt' => ''.get_the_title().'', 'title' => ''.get_the_title().'')); ?></a>
    <?php endif; ?>
    <div class="inside">
    <div class="metaCat"><?php _e('In', 'themetrust'); ?> <?php the_category(', ') ?></div>
    <h1><a href="<?php the_permalink() ?>" rel="bookmark" ><?php the_title(); ?></a></h1>
    <div class="meta clearfix">
    <?php _e('Posted by:', 'themetrust'); ?> <?php the_author_posts_link(); ?> <?php _e('on', 'themetrust'); ?> <?php the_time( 'M j, Y' ) ?> | <a href="<?php comments_link(); ?>"><?php comments_number(__('No Comments', 'themetrust'), __('One Comment', 'themetrust'), __('% Comments', 'themetrust')); ?></a>
    </div>
    <?php $content = get_the_content(''); ?>
    <?php $content = apply_filters('the_content', $content); ?>
    <?php echo wpt_strip_content_tags($content); ?>
    <?php more_link(); ?>
    </div>
    </div>

    <?php endwhile; ?>

    <?php include( TEMPLATEPATH . '/includes/pagination.php'); ?>
    </div> <!-- end content -->

    <?php get_sidebar(); ?>
    </div>

    <?php get_footer(); ?>`

  10. efpeterson
    Member
    Posted 1 year ago #

    Still only displaying the page title.

  11. nickkos
    Member
    Posted 1 year ago #

    That should be enough...` <?php
    /*
    Template Name: Blog
    */
    ?>

    <?php get_header(); ?>
    <div id="main" class="clearfix">
    <div id="content" class="full clearfix twoThird">
    <?php while (have_posts()) : the_post(); ?>
    <?php $c++; ?>
    <?php $postClass = has_post_thumbnail() ? $postClass = "withThumb" : $postClass = ""; ?>
    <?php $postClass = $c == $post_count ? $postClass = $postClass." lastPost" : $postClass = $postClass; ?>
    <div class="post clearfix <?php echo $postClass; ?>">

    <?php if(has_post_thumbnail()) : ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" ><?php the_post_thumbnail('ttrust_small', array('class' => 'postThumb', 'alt' => ''.get_the_title().'', 'title' => ''.get_the_title().'')); ?></a>
    <?php endif; ?>
    <div class="inside">
    <div class="metaCat"><?php the_category(', ') ?></div>
    <h1><a href="<?php the_permalink() ?>" rel="bookmark" ><?php the_title(); ?></a></h1>
    <div class="meta clearfix">
    Posted By:<?php the_author_posts_link(); ?><?php the_time( 'M j, Y' ) ?> | <a href="<?php comments_link(); ?>"><?php comments_number(__('No Comments', 'themetrust'), __('One Comment', 'themetrust'), __('% Comments', 'themetrust')); ?></a>
    </div>
    <?php the_content(); ?>
    <?php more_link(); ?>
    </div>
    </div>

    <?php endwhile; ?>

    <?php include( TEMPLATEPATH . '/includes/pagination.php'); ?>
    </div> <!-- end content -->

    <?php get_sidebar(); ?>
    </div>

    <?php get_footer(); ?> `

  12. nickkos
    Member
    Posted 1 year ago #

    Why isnt /code working in forum?

  13. efpeterson
    Member
    Posted 1 year ago #

    Still doesn't work. Still only displaying page title. Code just worked for me a few minutes ago when I posted the original page code.

Topic Closed

This topic has been closed to new replies.

About this Topic