WordPress.org

Support

Support » How-To and Troubleshooting » Showing most recent EXCERPT on all post pages

Showing most recent EXCERPT on all post pages

  • I’d like to show the snippet of the most recent post in the sidebar of all pages.

    The sidebar template contains <?php the_content_limit(200, ""); ?> which works fine on the homepage, but shows not just the excerpt when viewed on all other pages (alongside a post).

    This is presumably because <!--more--> doesn’t signify the end of the displayed content when it’s on a post page.

    How would I get around this?

    thanks,
    Paul

Viewing 2 replies - 1 through 2 (of 2 total)
  • You could use conditional tags to say if it is the homepage, then <?php the_content_limit(200, “”); ?>, and if it isn’t then <?php the_excerpt(); ?>

    You can learn more about conditional tags here: http://codex.wordpress.org/Conditional_Tags

    I’m not sure (been a long day), but if you paste your intended “excerpt” text into that “Excerpt” box in the post in question, that will force WP to spit out that excerpt code and hopefully bypass the <!– more –> thing (don’t you love when I talk all technical!). Worth a shot.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Showing most recent EXCERPT on all post pages’ is closed to new replies.