Loop Showing 1 Post Only
-
On the website I am working on, the loop was working great until I styled it. To do this I separated off aspects of the loop by placing them in divs. However, once I did this, and the loop was looking pretty close to how I wanted it, the loop began displaying only one post. I have checked and rechecked the functions file, and nothing is different there from what it was when the loop was working fine. I also checked the Settings -Reading section and made sure the max post was set to 5, but it still continues to show just the last post made.
I also realize that there is another loop on this page to display the post, but this problem is the same across all pages, even those without another loop to be bothered with. It is also worth noting that, even on this page, the loop was working fine and displaying 5 posts before I styled it.
I had a look on another forum where someone was having this same problem 4 years ago, but that person never got an answer. Any ideas anyone? I am including the code for the page I am working on here. The section that is giving me trouble would be under blogcontainer:
<?php get_header(); ?> <div id="mySidenav" class="sidenav" style="background-image: url('http://mysite.com/wp-content/uploads/year/month/image.jpg')"> <a href="void(0)">×</a> <?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?> </div> <div id="sidebar"> <div id="top"> <div id="menucontainer" cursor:"pointer" onclick="openNav()"> <p> Menu </p> <div class="bar"></div> <div class="bar"></div> <div class="bar"></div> </div> </div> <div id="middle" style="background-image: url('http://mysite.com/wp-content/uploads/year/month/image.jpg')"></div> <div id="bottom"></div> </div> <div id="center"> <header> <!-- post title --> <h1> <a>" title="<?php the_title(); ?>"><?php the_title(); ?></a> </h1> <!-- /post title --> <!-- post thumbnail --> <?php if ( has_post_thumbnail()) : // Check if Thumbnail exists ?> <a>" title="<?php the_title(); ?>"> <?php the_post_thumbnail(); // Fullsize image for the single post ?> </a> <?php endif; ?> <!-- /post thumbnail --> </header> <div id="post"> <?php if (have_posts()): while (have_posts()) : the_post(); ?> <!-- article --> <span id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <!-- post details --> <span class="date"><?php the_time('F j, Y'); ?></span> <span class="comments"><?php if (comments_open( get_the_ID() ) ) comments_popup_link( __( 'Leave your thoughts', 'html5blank' ), __( '1 Comment', 'html5blank' ), __( '% Comments', 'html5blank' )); ?></span> <!-- /post details --> <?php the_content(); // Dynamic Content ?> <?php the_tags( __( 'Tags: ', 'html5blank' ), ', ', '<br>'); // Separated by commas with a line break at the end ?> </span> <!-- /article --> <?php endwhile; ?> <?php else: ?> <!-- article --> <article> <h1><?php _e( 'Sorry, nothing to display.', 'html5blank' ); ?></h1> </article> <!-- /article --> <?php endif; ?> </div> <div id="comments"> <?php comments_template(); ?> </div> <footer> <p class="copyright"> © 2016 - <?php echo date('Y'); ?> Copyright <?php bloginfo('name'); ?>. </p> <p> This site is meant for entertainment purposes only and is not intended to replace professional knowledge. </p> </footer> </div> <div id="rightcontainer"> <div id="searchbox"> <form class="search" method="get" action="<?php echo home_url(); ?>" role="search"> <input class="search-input" type="search" name="s" placeholder="<?php _e( 'To search, type and hit enter.', 'html5blank' ); ?>"> <button class="search-submit" type="submit" role="button"><?php _e( 'Search', 'html5blank' ); ?></button> </form> </div> <div id="blogcontainer"> <?php query_posts('post_type=post') ?> <?php if (have_posts()): while (have_posts()) : the_post(); ?> <div class="postcontainer" id="post-<?php the_ID(); ?>"> <div class="thumb"> <?php if ( has_post_thumbnail()) : // Check if thumbnail exists ?> <a>" title="<?php the_title(); ?>"> <?php the_post_thumbnail(array(100,100)); // Declare pixel size you need inside the array ?> </a> <?php endif; ?> </div> <div class="topblock"><div class="titleblock"> <a>" title="<?php the_title(); ?>"><?php the_title(); ?></a></div> <div class="moreblock">MORE ></div> </div> <div class="block"> <div class="date"><p><span class="date"><?php the_time('F j, Y'); ?></span></p></div> <?php html5wp_excerpt('html5wp_index'); ?> </div> <?php endwhile; ?> <?php else: ?> <h2><?php _e( 'Sorry, nothing to display.', 'html5blank' ); ?></h2> <?php endif; ?> </div> </div> </div> <?php get_footer(); ?>The page I need help with: [log in to see the link]
The topic ‘Loop Showing 1 Post Only’ is closed to new replies.
