• n0ts0smart

    (@efpeterson)


    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: https://tinyurl.com/br8efzw

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

Viewing 12 replies - 1 through 12 (of 12 total)
  • Webstractions

    (@webstractions)

    Try publishing the page first. We can’t view your “preview only” pages.

    Thread Starter n0ts0smart

    (@efpeterson)

    Thread Starter n0ts0smart

    (@efpeterson)

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

    nickkos

    (@nickkos)

    Make sure that your

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

    Thread Starter n0ts0smart

    (@efpeterson)

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

    nickkos

    (@nickkos)

    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; ?>
    Thread Starter n0ts0smart

    (@efpeterson)

    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(); ?>
    nickkos

    (@nickkos)

    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(); ?>`

    Thread Starter n0ts0smart

    (@efpeterson)

    Still only displaying the page title.

    nickkos

    (@nickkos)

    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(); ?> `

    nickkos

    (@nickkos)

    Why isnt /code working in forum?

    Thread Starter n0ts0smart

    (@efpeterson)

    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.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Blog Page Showing Page Name’ is closed to new replies.