• Resolved cedricbenjamin

    (@cedricbenjamin)


    Hi,

    I’ve seen the same question here and here, but these post are old and the code solution doesnt work anymore.

    I’ve seen 2 simple plugin that use to do that, but there are no longer updated (since 2008)

    I just want my excerpt to be display, before : “this post is password protected. to view it please enter your password below”

    So i hope there is a code solution that works (i prefer not to use big membership plugin, but maybe it’s the only way ?)

    Tanks in advance for help
    Ben

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    I lost 1 hour yesterday to find how to do that and finally I had to code it myself.

    Add the following code to your functions file

    /**
    * Custom
    * Make excerpt visible on protected posts
    **/
    function my_excerpt_protected( $excerpt ) {
    if ( post_password_required() )
    {
    $post = get_post();
    $excerpt=$post->post_excerpt;
    }
    return $excerpt;
    }
    add_filter( ‘the_excerpt’, ‘my_excerpt_protected’ );

    Thread Starter cedricbenjamin

    (@cedricbenjamin)

    Agrumeprod,

    Tx so much for your work, but without solution for near a month, i choose a another way to privatise my post.

    I’m sorry, i guess i should close it before.

    cedben

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display the excerpt in password protected post’ is closed to new replies.