WordPress.org

Forums

[resolved] the_content() with $more=1 not working (3 posts)

  1. Shasta
    Member
    Posted 3 years ago #

    I want to show all the content for posts on a page that isn't a single-page. The page for the_content says to do this:

    <?php
    global $more;    // Declare global $more (before the loop).
    $more = 1;       // Set (inside the loop) to display all content, including text below more.
    the_content();
    ?>

    So I wrote this:

    <?php global $more; $more = 1; //declare and set $more before The Loop ?>
    	<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    		<?php $more = 1;  the_content(); ?>
    	<?php endwhile; else: ?>
    	<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    	<?php endif; ?>

    Unfortunately it's still only showing the first two paragraphs. (Oddly it always breaks after the second paragraph, NOT after a certain number of words. Maybe this is a clue?)

    Here is an example page: http://jaxworx.litsam.com/category/ch2/

    It is displaying the first two paragraphs of two posts. There are more paragraphs not displaying. (There are only two posts though.)

  2. alchymyth
    Forum Moderator
    Posted 3 years ago #

    there is some hidden html after the four shown paragraphs:

    <div class="post-teaser-block">This is a preview of <q>On a dog appearing</q>. <a href="http://jaxworx.litsam.com/2011/on-a-dog-appearing/" title="Permanent Link: On a dog appearing" rel="bookmark">Read the full post (664 words, estimated 2:39  mins reading time)</a></div>	</div>
    </div><!-- #book -->
    which might point to a plugin or some other code that controls the content length; search the activatged plugins if one of them might be interfering; and check functions.php for a possible filter on the content length.

  3. Shasta
    Member
    Posted 3 years ago #

    Thank you. It turns out that the SEO Automatic plug-in includes the Post Teaser plug-in as an option. Although I don't remember ever having used it, and it reports that it should be off by default (and showed being off) saving the settings (SEO Panel, bottom of the screen, "set plugins") with them all toggled to off indicated success turning off Post Teaser. (The others indicated they were already off.)

    I had to do it per sub-site (it's an MU installation) as changing it at the top level didn't seem to help. Fortunately I only have one sub-site as I'm in development.

    What an unbelievable mess! Thanks for the tip that pointed me in the right direction. My whole post shows now.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.