[resolved] Conditional tag to check for <!-- more -->? (3 posts)

  1. 3stripe
    Posted 9 years ago #

    Hi folks,

    I'm a-hunting for a conditional tag that will tell me whether the current page/post in the loop contains a <!-- more --> tag...

    I don't really know php, but something (!) like this:

    <?php if (preg_match("more", $post->post_content)) {

    I've tried '!empty($post->post_excerpt)' but this checks for some actual text inside the wee excerpt box, not the main post.

    Any ideas much appreciated!

    Thank you.

    PS. I plan to use this in conjunction with http://wordpress.org/support/topic/68137?replies=9 which splits a post into 2 columns at the more tag.

  2. 3stripe
    Posted 9 years ago #

    Ok, I think I cracked it!

    For anyone interested:

    <?php if(strstr($post->post_content,'<!--more-->')) { echo 'we found a more tag!'; } else { echo 'no more tag found, sorry'; } ?>

  3. saphod
    Posted 8 years ago #

    Thanks, mate - that was exactly what I was looking for!

Topic Closed

This topic has been closed to new replies.

About this Topic