• Hello.

    I’m trying to get my posts to display the full content when “Continue reading” is clicked, but I cannot get it to work.

    This is what I have in single.php :

    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<h1 class="entry-title"><?php the_title(); ?></h1>
    <div class="entry-meta">
    	<?php twentyten_posted_on(); ?>
    </div>
    <div class="entry-content">
    	<?php the_content(); ?>
    	<?php wp_link_pages( array( 'before' => '<div class="page-link">
    '. __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    </div>
    [...]
    </div>

    …and this is loop.php :

    <div id="post-<?php the_ID(); ?>"
             <?php post_class(); ?>>
    		<h2 class="entry-title"><a href="<?php
    the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink
    to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>"
    rel="bookmark"><?php the_title(); ?></a>
                    </h2>
        <div class="entry-meta">
    	<?php twentyten_posted_on(); ?>
        </div>
            <?php if ( is_archive() || is_search() ) : ?>
        <div class="entry-summary">
    	<?php the_excerpt(); ?>
        </div>
    	<?php else : ?>
        <div class="entry-content">
    	<?php the_content( __( 'Continue reading <span
    class="meta-nav">→</span>', 'twentyten' ) ); ?>
    	<?php wp_link_pages( array( 'before' => '<div
    class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' =>
    '</div>' ) ); ?>
       </div>
    [...]
    </div>

    Here is the page in question.

    Any suggestions would be greatly appreciated.

    Bob

Viewing 1 replies (of 1 total)
  • Thread Starter nobody5973

    (@nobody5973)

    Here are some of the things that I’ve tried. I could use some help, if anybody…

    1. Attempt: Override the Archive behaviour, since I only want the content above the <!–more–> tag, using advice found here


    <?php global $more;
    $more = 0;
    the_content("Read more...");?>

    Settings:

    loop.php:


    <?php else : ?>
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <h2 class="entry-title">" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></h2>
    <div class="entry-meta">
    <?php twentyten_posted_on(); ?>
    </div>
    <?php if ( is_archive() || is_search() ) : ?>
    <div class="entry-summary">
    <?php the_excerpt(); ?>
    </div>
    <?php else : ?>
    <div class="entry-content">
    <?php the_content(); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    </div>
    <?php endif; ?>

    functions.php:

    function twentyten_continue_reading_link() {
    return ' ' . __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) . '';
    }
    function twentyten_auto_excerpt_more( $more ) {
    return ' …' . twentyten_continue_reading_link();
    }
    add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );

    Result: Failed.
    On the Archives page I have the follwing:
    -all posts show up with excerpts, but with broken “Continue reading ” links, which resolve to duplicate content.

    2. Attempt: Change Archive and Search to the_content as well, use <!–more–> tag to separate content and use global $more=0 to show the above content of the tag:


    <div class="entry-content">
    <?php the_content(); ?>
    </div>

    <?php
    global $more;
    $more = 0;
    the_content("Read more...");?>

    Settings: functions.php unchanged

    Result: Failed (miserably)
    -all posts shows as excerpts, but continue_reading_link is not resolving correctly. On “Continue Reading” click, I loose the sidebar, post title goes under the post etc. (breaks the template)

    3. Attempt: Modify the excerpt functions
    – I linked “Read more…” to the post like this in functions.php:

    function twentyten_continue_reading_link($more) {
    return ' ID) . '">' . ( 'Read more...') . '';}
    add_filter( 'excerpt_length', 'twentyten_continue_reading_link' );
    function twentyten_auto_excerpt_more( $more ) {
    return ' …';
    }
    add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );

    loop.php stays unchanged.

    Result:Disappointing…
    -all posts as excerpts with “Continue Reading” links.
    -no post content on click after leaving Archive page.

    That’s about all I could think of…

    Any help appreciated.

    Bob

Viewing 1 replies (of 1 total)

The topic ‘[the_content] Post not displaying full content’ is closed to new replies.