• 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: https://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–>’

Viewing 1 replies (of 1 total)
  • Thread Starter wmaurojr

    (@wmaurojr)

    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-->
Viewing 1 replies (of 1 total)
  • The topic ‘Post being assigned a page class’ is closed to new replies.