Forums

[resolved] HELP to get a teaser out of a page? (almost there) (2 posts)

  1. Zambrano Sergio
    Blocked
    Posted 2 years ago #

    I'm trying to get to work a regex to trim all the content before the "more" tag, but I'm sure there is ALREADY a function or variable containing / filtering the content, or you know how to get those functions properly to…

    GET A PAGE'S TEASER outside of the loop.

    The approach I was using is at
    http://wordpress.org/support/topic/378807?replies=3&post-1447500
    and fails at the regex match (same used by wordpress to locate the "more" tag)

    I wonder there is a easier approach… (I didn't find a plugin for allowing excerpts in pages :( )

  2. Zambrano Sergio
    Blocked
    Posted 2 years ago #

    Got it!!
    This line did the trick.
    $testimonial_teaser = preg_replace('/<!--more.*/s', '', $testim_page->post_content);

Topic Closed

This topic has been closed to new replies.

About this Topic