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.

Before I call the_excerpt(), the_permalink() displays the correct thing. Afterwards, it does not...

            <?php 
            global $query_string;

            //strip out the "pagename=blog" so that the query will grab all of the posts instead of the content of the blog page
            $query_string = preg_replace("/pagename=[a-zA-Z0-9]*/", "", $query_string);
            query_posts( $query_string . "posts_per_page=3" );

            if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                <li class="post-listing"> 
                        <div class="no-col">
                            <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> 
                            <p class="meta">Posted on <?php print get_the_date(); ?> by <?php the_author(); ?> in <?php the_category(', ') ?></p>
                        <!--
                        <?php the_permalink(); ?>
                        -->

                            <?php the_excerpt(); ?>
                        <!--
                        <?php the_permalink(); ?>
                        -->

                            <p class="meta"><?php the_tags('') ?></p>
                            <div class="navigation"><a class="alignright" href="<?php the_permalink(); ?>">READ MORE &raquo;</a></div>
                        </div>
                </li> 
            <?php endwhile; else: ?>
                <li><?php _e('Sorry, no posts matched your criteria.'); ?></li>
            <?php endif; ?>

I have a page called "blog.php" that I have defined as a Template named "blog" that people can apply to a page they create (so that they can have a blog listing page, I know there is probably a better way, but this is the solution that was gone with for various reasons).

It was working just fine, but now (a month after I wrote it) it suddenly stopped working. I have narrowed the problem (I think) down to the the_excerpt() call. The permalink displays fine before that, but afterwards craps out and instead displays the permalink for the blog.php page... I think that the_excerpt() is throwing everything completely out of "The Loop" and then the current post it sees just becomes the page that uses the blog.php template (it spits the contents of that page out and then stops as if that page were the last post in The Loop).

This also happens if I replace "the_excerpt()" with "the_content()" or "get_the_excerpt()"

share|improve this question
1  
does the theme use any filter function on the excerpt or related template tags? –  Michael Jun 28 '11 at 18:31
    
Two. One to change the length of the excerpt to just be "50". One to change the ellipses to just "..." instead of "[...]". They are each, like, 3 lines of code, so nothing that would cause what is happening (that I can tell). –  cmcculloh Jun 29 '11 at 3:02
    
take a look on function reference –  Ramkumar Jun 29 '11 at 4:32
    
What about it? The two filter functions I stated as having are basically mentioned in the function reference, btw, so it can't be those... –  cmcculloh Jun 30 '11 at 2:28

1 Answer 1

up vote 1 down vote accepted

I had installed the "Facebook Comments for WordPress" plugin. This plugin attaches a filter to the_content();. The filter contains the line wp_reset_query();. Commenting this out fixes the problem (this is sub-optimal though, because, now the client will be unable to update the plugin).

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.