I’m not sure if this is even possible, but I thought I would ask anyway. I’m currently using a custom plugin that connects to my forums. If people are in a certain custom usergroup, they can see the full content of a post (the_content
). If they’re not, they only see the post’s first 55 words (the_excerpt
). You can see the abbreviated code here, which I’m using on my theme’s single.php page:
<?php // IN X USER GROUP
if($customgroup==1 || // Are they in the custom group?
$userinfo->usergroup == 66) { // or the admin of the website?
echo the_content();
} else { // They aren't in the custom group
echo the_excerpt ();
}
?>
However, the_excerpt
only allows me to show the first 55 words of the post to the non-X group members.
What I want to do is set exactly where the excerpt ends. That way, I can control what the non X-group members can see up to. I’ve tried using WordPress’s more tag to denote where the excerpt should end, but haven’t had any success getting it to work. I’ve used it in combination with both the the_content
and the_excerpt
, but they both ignore it.
I’m not sure what I’m doing wrong. If I’m approaching this all wrong, what I just want to do is show the entire post to the X group members and show the excerpt I’ve denoted by the more tag to the non-X group members. Anyone have any ideas? Thank you!
first of all you don’t need to
echo the_content(); and the_excerpt();
both methods already echod, second simply put the more link using permalink afterthe_excerpt();
like this.Edited: added second param
true
tothe_content('', true)
this will cut off the content after<!--more-->
quicktag.