Forums

loop won't show first (5 posts)

  1. ispideyi
    Member
    Posted 2 years ago #

    Hi,

    I am currently using the following theme from: http://www.press75.com/folio-elements-theme-demo/

    The loop from the index.php pulls up the number of posts I want but the focused post only shows the 2nd most up to date post. I've tried tweaking query_posts to use "&orderby=date" as well other changes but it keeps showing the 2nd post.

    Anyone know or have any idea what I can adjust to make it show the latest?

    Thanks.

  2. ispideyi
    Member
    Posted 2 years ago #

    Sorry, here is the code inside the index.php

    <?php get_header(); ?>
    
    <div id="content">
    
    <div class="carousel main">
    
        <a href="#" class="prev">&nbsp;</a>
    
        <div class="rotate">
    
            <ul>
    
            	<?php query_posts('showposts=10' . "&orderby=date"); ?>
    
    			<?php if (have_posts()) : ?>
    
                <?php while (have_posts()) : the_post(); ?>
    
            	<li>
    
                	<a href="<?php get_content('post', $post->ID); ?>" rel="facebox" title="<?php the_title_attribute(); ?>"><img src="<?php echo get_thumbnail($post->ID); ?>" alt="<?php the_title_attribute(); ?>" /></a>
    
                    <div class="intro">
    
                    	<h3><a href="<?php get_content('post', $post->ID); ?>" rel="facebox" title="<?php the_title_attribute(); ?>"><?php the_title() ?></a></h3>
    
                        <?php the_excerpt(); ?> 
    
                    </div>
    
                </li>
    
                <?php endwhile; ?>
    
                <?php else : ?>
    
                <?php endif; ?>
    
            </ul>
    
        </div>
    
        <a href="#" class="next">&nbsp;</a>
    
    </div>
    
    </div>
    
    <?php get_footer(); ?>
  3. ikirudesign
    Member
    Posted 2 years ago #

    The most likely cause--I see nothing in that code that's obviously doing it--is the query_post loop. query_post loops can easily get thrown off if you're trying to use more than one loop on a page. That's why it's been recommended for a while that you make your own loop, with WP_Query.

  4. ispideyi
    Member
    Posted 2 years ago #

    I've been looking over source of the pages and it does appear that the first post is being pulled properly as the first post in the page.

    It might be the javascript that loads the sliding posts that is loading the 2nd post instead.

    I'm gonna try to look into this to see if I can make adjustments via the javascript route. Thanks for the recommendation anyways.

  5. ispideyi
    Member
    Posted 2 years ago #

    Alright, it appears that the loop was never the issue as I previously figured out. It was the javascript file that was loading the previous post. I've made the proper adjustments and fixed it.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.