WordPress.org

Ready to get started?Download WordPress

Forums

Post being assigned a page class (2 posts)

  1. wmaurojr
    Member
    Posted 10 months ago #

    I'm trying to create a theme from scratch and am running into a problem with the loop. Instead of displaying posts, the loop generates only one "post" with classes of 'page' and 'type-page'. Even the 'post-title' is being printed with the title of the page. Do I need to pass a parameter to specify exactly what I want displayed?

    URL: http://stolensheepdesign.com/?page_id=2

    Code:

    '<div id="blog_content" class="col-md-9">

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

    <article <?php post_class('blog_post'); ?> id="post<?php the_ID(); ?>">

    <header>

    <?php if(comments_open() && !post_password_required()){
    comments_popup_link('0', '1', '%', 'article-meta-comments');
    } ?>
    <p class="post_categories"><?php the_category('&nbsp&nbsp/&nbsp&nbsp'); ?></p>
    <h1 class="post_title">"><?php the_title(); ?></h1>
    <p class="post_date"><?php the_time(get_option('date_format')); ?>, by <?php the_author_posts_link(); ?></p>

    </header>

    <?php if (has_post_thumbnail()) : ?>

    <figure class="post_thumbnail">
    "><?php the_post_thumbnail(); ?>
    </figure>

    <?php endif; ?>

    <?php the_content('Read More &raquo'); ?>

    </article>

    <hr class="fancy-hr" />

    <?php endwhile; else : ?>

    <h1>No posts were found.</h1>

    <?php endif; ?>

    </div><!--End blog_content-->'

  2. wmaurojr
    Member
    Posted 10 months ago #

    Code Formatted:

    <div id="blog_content" class="col-md-9">
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    				 	<article <?php post_class('blog_post'); ?> id="post<?php the_ID(); ?>">
    
    						<header>
    
    							<?php if(comments_open() && !post_password_required()){
    								comments_popup_link('0', '1', '%', 'article-meta-comments');
    								} ?>
    							<p class="post_categories"><?php the_category('&nbsp&nbsp/&nbsp&nbsp'); ?></p>
    							<h1 class="post_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
    							<p class="post_date"><?php the_time(get_option('date_format')); ?>, by <?php the_author_posts_link(); ?></p>
    
    						</header>
    
    						<?php if (has_post_thumbnail()) : ?>
    
    						<figure class="post_thumbnail">
    							<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>
    						</figure>
    
    					<?php endif; ?>
    
    					<?php the_content('Read More &raquo'); ?>
    
    					</article>
    
    					<hr class="fancy-hr" />
    
    				 <?php endwhile; else : ?>
    
    				 <h1>No posts were found.</h1>
    
    				<?php endif; ?>
    
    </div><!--End blog_content-->

Reply

You must log in to post.

About this Topic