Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I pulled recent posts onto my website using a fetch X posts loop with some PHP for WP's "The Loop". At the end, it also returns a line of dashes as a sort of end of document delineator. Is there a way to omit this last line of dashes?

This is my code which is a mashup of examples from the web and also with a few formatting tweaks:

$posts = get_posts('numberposts=100&order=ASC&orderby=post_date');
foreach ($posts as $post) : start_wp(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<?php the_title('<h3><a href="' . get_permalink() . '" title="' .       the_title_attribute('echo=0') . '" rel="bookmark"style="color: #000000">', '</a>  </h3>'); ?>

<p class="byline">

<abbr class="published" title="<?php the_time(__('l, F jS, Y, g:i a', 'example')); ?>"><?php the_time(__('F j, Y', 'example')); ?></abbr>
<?php edit_post_link(__('Edit', 'example'), ' <span class="sep">|</span> <span class="edit">', '</span> '); ?>

<div class="entry-content">
<?php the_content(__('Continue reading', 'example')); ?>
<?php wp_link_pages('before=<p class="pages">' . __('Pages:','example') . '&after=</p>'); ?>

<p class="entry-meta">

<span class="sep"></span> <?php comments_popup_link(__('Leave a response', 'example'), __('1 Response', 'example'), __('% Responses', 'example'), 'comments-link', __('Comments closed', 'example')); ?> 



I suppose using code such as the following for/each loop might solve the problem, but code like this never pulled anything over:

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

<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
share|improve this question
Not seeing anything in the first code block that indicates it is adding extra dashes. Are you sure it's not in your CSS? –  GhostToast May 31 '13 at 17:16
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.