Forums

[resolved] showing summary and continue reading link for twenty eleven theme (11 posts)

  1. michaeloc
    Member
    Posted 5 months ago #

    Hi I have been struggling to get a solution to this.

    I have set up a 2011 child theme and added several custom post types.

    I would like each entry to show a summary with a read more link, which links to the full entry on it's own page

    in content.php I can see that it is using the following code, can anyone advise how I can edit the code to display an excerpt and readmore link when it's on an index page and a the full content when on it's own page

    ' <div class="entry-content">
    <?php the_content(); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
    </div><!-- .entry-content -->'

  2. ChristiNi
    Member
    Posted 5 months ago #

    Hi michaeloc,

    The easiest way to do that in Twenty Eleven is to add the <!--more--> tag in your post where you want the excerpt to end and a "Continue reading" link to be placed:

    http://codex.wordpress.org/Customizing_the_Read_More

    Hope this helps!

  3. michaeloc
    Member
    Posted 5 months ago #

    Hi Christi,

    thanks I think I will go with the easier of the two (add the <!--more--> tag in post)

    This works for posts in the default blog but not for custom posts type entries.

    I used a page template to display the list of posts in my custom post types page and I think this is causing the problem

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 5 months ago #

    http://codex.wordpress.org/Customizing_the_Read_More#How_to_use_Read_More_in_Pages

    <?php
    global $more;
    $more = 0;
    ?>
    //The code must be inserted ahead of the call to the content
    
    <?php the_content('Continue Reading'); ?>

    Use this to enable it on page templates

  5. michaeloc
    Member
    Posted 5 months ago #

    thanks for the code voodoo

    is there a way to have the linked page open at the top of the page rather than open from where the continue reading link

    see link to site

    http://www.ndgtest.com/kinlay/special-offers/

  6. michaeloc
    Member
    Posted 5 months ago #

    Hi again vodoo

    I checked the codex and found a function that removes the jump link so you can ignore last question thanks.

    BTW I really appreciate both contributions to this thread thanks

  7. Rev. Voodoo
    Volunteer Moderator
    Posted 5 months ago #

    Glad you got it figured out!

  8. ChristiNi
    Member
    Posted 5 months ago #

    You're welcome michaeloc,

    If you have time, please mark this as resolved and give us the details the function you found that removes the jump link.

    Thanks!

  9. michaeloc
    Member
    Posted 5 months ago #

    Thanks Christi here's that function

    // sends readmore link to top of page
    
    function remove_more_jump_link($link) {
    $offset = strpos($link, '#more-');
    if ($offset) {
    $end = strpos($link, '"',$offset);
    }
    if ($end) {
    $link = substr_replace($link, '', $offset, $end-$offset);
    }
    return $link;
    }
    add_filter('the_content_more_link', 'remove_more_jump_link');
  10. Rev. Voodoo
    Volunteer Moderator
    Posted 5 months ago #

    Thanks for returning and providing your solution to help future readers!

  11. ChristiNi
    Member
    Posted 5 months ago #

    Yes, thank you michaeloc!

Reply

You must log in to post.

About this Topic