Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • I meant to edit my last post and ended up posting another. My bad.

    I know it’s a little late but I thought this might help if someone else has this problem in the future…

    I could not find a native function to check to see if we were in the last post of the loop. My way around this was to set a constant equal to the amount of posts to display on a page (you set this value in the settings) and keep track of how many posts we have displayed. When we are in the last one, you do whatever special stuff you wanted to do. I also could not find a way an easy way to get this so I can to use a “magic number.”

    In my case, I wanted to display an <hr /> after each post, but not after the last post (it looked stupid with my template).

    <?php
    $postCount = 0;
    define(POSTS_PER_PAGE,3); //this example assumes i display 3 posts on the main page
    while (have_posts()):
    	the_post();
    	if (++$postCount !== POSTS_PER_PAGE):
    		// we're not at the last post, display it regularly
    	else:
    		// here is the last post, print it out with your special formatting
    	endif;
    endwhile;
    ?>

    I just visited your site running Windows XP and IE 7 with no problems (I even scrolled down ?? ).

    I’m not that familiar with WP however you could try uninstalling the plugins you listed in your first post in reverse order (start with the last one your installed).

    I have no idea how it will affect your site and/or the features/sections/areas. I take no responsibility for what may happen.

    What are you running (operating system/browser)? The more your can post, the more people may be able to help.

    Thread Starter bigrodey77

    (@bigrodey77)

    *RESOLVED*

    If I could buy you a beer I would.

    Thanks!

    Thread Starter bigrodey77

    (@bigrodey77)

    Something … Anything … Anyone?

    Thread Starter bigrodey77

    (@bigrodey77)

    Hey!!

    I forget to add that if I use the index.php page that came with WordPress and *not* my code, everything works fine.

    I know everyone will say check my code and I already have. Here is the main part of my code where I am using the WordPress functionality.

    <div id="content">
    			<?php if (have_posts()) : while (have_posts()) : ?>
    
    			<span id="title"><?php the_title(); ?></span><br />
    			<span id="time"><?php the_time('F jS, Y'); ?></span><br /><br />
    			<?php the_post(); the_content(); ?><br />
    			<span id="category">Posted in <?php the_category(', ') ?></span><br /><br />
    		    <?php endwhile; endif; ?>
    		</div>
Viewing 6 replies - 1 through 6 (of 6 total)