maybe you need to add global $post;
at the beginning of your code;
it might help if you post the code of your filter function (please use the http://pastebin.com/, if it is longer than 10 lines)
alchymyth,
Actually I am trying to hack the Simple Content Restriction plugin (http://wordpress.org/extend/plugins/your-id-please/faq/) which is Open Source.
The exact code is here in GitHub:
https://github.com/stas/your-id-please/blob/master/please-login.php#L47
The “global $post;” is already there. On like 56:
https://github.com/stas/your-id-please/blob/master/please-login.php#L56
The plugin returns only the login link instead of the $content, I want to concatenate there the excerpt, but whatever I try to fetch the excerpt always comes empty or breaks the rendering.
Thanks for your response,
i have it working with: (in function yidp_content( $content ) {
after line 55 of please-login.php)
if( $yidp_message && !is_user_logged_in() )
return apply_filters('the_excerpt', get_the_excerpt()) . '<p><a href="' . wp_login_url( get_permalink() ) .'">' . $yidp_message. '</p>';
else
return $content;
it outputs the excerpt and the link-text for non-logged-in user; and the content for logged-in user.
alchymyth,
Thanks for you fast help, I tried your patch but the excertp is not showing and the page is rendered incomplete. Also I have nothing in error_log.
I think I will try it from scratch in a clean wp installation, Any idea?