• hello

    is it possible to have a little text (a sentence or two) before the form for a protected post, note the generic one but a text customized for a specific post ?

    TIA

    Luc

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter lstelie

    (@lstelie)

    Thanks a lot amory

    In case someone is ine the same situation here is the solution :

    1 – fill the excerpt field (on the top of the main post text in write mode)

    2 open wp-includes/templates-function-post.php

    after
    function get_the_password_form() {
    Line 3
    Add
    the_excerpt();

    go to get_the_excerpt() (line 100)

    Comment the bloc :
    if (!empty($post->post_password)) { // if there's a password
    if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
    $output = __('There is no excerpt because this is a protected post.');
    return $output;
    }

    }

    Now when you pasword protect a post the excerpt is displayed so you can add a customized sentence

    Hope this helps

    Luc

    This tip was extremely helpful, if I do say so… and I do. It’s exactly what I was looking for.

    Muchos gracias, lstelie.

    hi!
    I’d like to do the same with a page template, is it possible?
    I’d like to say
    IF this post is protected
    THEN display this line
    but I don’t speak PHP.
    thank you!
    ale.

    Does anyone know what’s the best way to force people to register to read a specific post?

    I can’t find a good way 🙁

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘A texte before a paswword protected post ?’ is closed to new replies.