Showing most recent EXCERPT on all post pages (3 posts)

  1. nicepaul
    Posted 8 years ago #

    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?


  2. kulpreetsingh
    Posted 8 years ago #

    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

  3. Joni
    Posted 8 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic