Forums

How to Identify <!-- more --> tag in plugin (2 posts)

  1. anes_pa
    Member
    Posted 2 years ago #

    Hello pals,
    I make a New Plugin in WordPress with Two types of posts ... In which only login user CAN view premium post and non-login user can only View normal posts only. But in my home page I limit the Content of each post with 1500 characters ... But I need to give <!-- more --> functionality there . But I don't know how to identify the occurence of <!-- more --> .. If any <!-- more --> come before 1500 characters I need to break the content listing in home page for Premium post. How it can done ... pls Give a good solution as early as possible...

    With Bunch of thanks

    Bye Anes P.A

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Not sure what variable you will store your post data, but:

    <?php
    //if a post has the more
    if (strpos($post->post_content, '<!--more-->')) {
    echo 'this post has the more';
    }
    ?>

    http://us2.php.net/manual/en/function.strpos.php
    http://us2.php.net/substr

    Also look at other plugins:
    http://wordpress.org/extend/plugins/evermore/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags