WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Separate before and after MORE from the_content (5 posts)

  1. jordanthegreat
    Member
    Posted 3 years ago #

    Hey guys,

    Is there a way that I can separate content before and after the <!--more--> tag from the_content?

    I know I can use the_excerpt to get the content before the tag, but how do I single out the content from after that tag?

    Cheers,
    Jordan

  2. alchymyth
    Forum Moderator
    Posted 3 years ago #

    http://codex.wordpress.org/Function_Reference/the_content

    should work in single.php; example:

    <?php if(strpos(get_the_content(),'id="more-')) :
    global $more; $more = 0;       // Set (inside the loop) to display content above the more tag.
    the_content(''); ?>
    <!--the area inbetween-->
    <?php $more = 1;
    the_content('', true ); // Set to hide content above the more tag.
    else : the_content();
    endif; ?>
  3. jordanthegreat
    Member
    Posted 3 years ago #

    That worked beautifully. Thanks a million.

  4. Bruno Costa
    Member
    Posted 2 years ago #

    THANK YOU!!!!!

  5. rc0
    Member
    Posted 2 years ago #

    i gettin a headache with this php but anyway this worked for me. ty alchymyth

Topic Closed

This topic has been closed to new replies.

About this Topic