0

I am using the "more" quick tag to cut off articles from non-paying members - as in, they can only read the first few paragraphs or so. My setup works perfectly, and here's a snippet of the code that shows what content to show when a non-paying member views an article:

    } else { // They aren't in the paying group  
        global $more;
        $more = 0;
        the_content('<b>Interested in reading the rest of this article? You must be a subscriber to continue reading.</b>'); 
} 
?>

However, this is what the code outputs to the non-paying members. For my purposes, the link is unnecessary:

<p> <a href="http://website.com/2013/08/news-story/#more-30729" class="more-link"><b>Interested in reading the rest of this article? You must be a subscriber to continue reading.</b></a></p>

I was wondering if it is possible to remove the link so that it only outputs like this:

    <p><b>Interested in reading the rest of this article? You must be a subscriber to continue reading.</b></p>

Thank you!

1 Answer 1

2

You need a filter on the_content_more_link.

else { // They aren't in the paying group  
  function strip_more_link($link,$linktext) {
    remove_filter('the_content_more_link','strip_more_link',1);
    return $linktext;
  }
  add_filter('the_content_more_link','strip_more_link',1,2);
  global $more;
  $more = 0;
  the_content('<b>Interested in reading the rest of this article? You  just be a subscriber to continue reading.</b>'); 
} 

It may be more efficient, or neater, to write a check into the callback rather than add and remove the filter inside the Loop but I don't how your "paid" vs "not paid" subscribers are marked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.