WordPress.org

Support

Support » Themes and Templates » [Resolved] Conditional tag to check for <!– more –>?

[Resolved] Conditional tag to check for <!– more –>?

  • 3stripe
    Participant

    @3stripe

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • 3stripe
    Participant

    @3stripe

    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'; } ?>

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Conditional tag to check for <!– more –>?’ is closed to new replies.