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

  • Resolved 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 which splits a post into 2 columns at the more tag.

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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 ‘Conditional tag to check for <!– more –>?’ is closed to new replies.