WordPress.org

Support

Support » Plugins and Hacks » How to determine if $content has a <!–more–> tag?

How to determine if $content has a <!–more–> tag?

  • Hey folks,
    I’m trying to determine if the post is shown in excerpt mode (with a <!–more–> tag or the whole of it is being shown at once. I require this for a plug-in which will insert a piece of code only in full-post mode and not in the excerpt mode.

    I’ve added a filter hook to ‘the_content’, and tried analyzing the contents of the variable, $content searching for the term <!–more–>. But I guess, WordPress parses this tag, even before it reaches the plug-in hook..

    What is the best possible way of determining this?

    Second question.. is there a filter hook, that’ll apply my plug-ins output ONLY to PAGES and NOT POSTS and vice-versa?

    Thanks,
    m^e

  • The topic ‘How to determine if $content has a <!–more–> tag?’ is closed to new replies.
Skip to toolbar