WordPress.org

Ready to get started?Download WordPress

Forums

Change my "If password required" function. STUCK! (12 posts)

  1. lykkelille
    Member
    Posted 7 months ago #

    I am desperately trying to change this message: "There is no excerpt because this is a protected post" on the index page into showing the actual password form, WITHOUT having to click into the actual post.

    Have been trying for a loong time now, but i seem to do something wrong as as soon as i change something, my whole wordpress page turns blank.

    This is what i have:

    if ( post_password_required() ) {
    return __( 'There is no excerpt because this is a protected post.' );
    }

    return apply_filters( 'get_the_excerpt', $post->post_excerpt );
    }

    And i want this text to turn into SHOWING THE PASSWORD FORM.

    Been trying for 2 days now. I am totally stuck :(

  2. lykkelille
    Member
    Posted 6 months ago #

    I found this page: http://justintadlock.com/archives/2009/06/24/showing-the-post-password-form-for-excerpts-in-wordpress

    And added the code into functions.php.. But its still not happening :/

  3. lykkelille
    Member
    Posted 6 months ago #

    If i change to the theme Twentyfourteen i get this form up as i want it to. But not on my custom theme (made with artisteer).. This is really annoying, what do i need to change/add to my custom theme to get this up like i do on "Twentyfourteen" ? :(

  4. lykkelille
    Member
    Posted 6 months ago #

    So i have been comparing the different functions.php files from the themes, plus the post-template.php.. But i am still lost, I don't know what to change, how, and where. It will make me SUPER happy if someone can point me in the right direction!

  5. WPyogi
    Volunteer Moderator
    Posted 6 months ago #

    If i change to the theme Twentyfourteen i get this form up as i want it to. But not on my custom theme (made with artisteer)..

    Have you asked on the Artisteer forums?

    http://www.artisteer.com/?p=forums

  6. lykkelille
    Member
    Posted 6 months ago #

    Made a post on there now. Grrr.. this is soo annoying and i have been trying to sort this out for the past 2 days...

    Thanks for your answer, WPyogi.

  7. lykkelille
    Member
    Posted 6 months ago #

    No answer on there :(

  8. lykkelille
    Member
    Posted 6 months ago #

    Does anyone know what file i need to edit? The theme itself, functions.php, or do i have to change post-templates? I have tried but i am lacking php expirience so i cant seem to get it right.

  9. lykkelille
    Member
    Posted 6 months ago #

    What i want to do is to post my_password_form at the front page. Seems like my theme is coded to not do this for some reason..

  10. bcworkz
    Member
    Posted 6 months ago #

    Filters do not work because of the way your code is structured. Instead add the filter code directly to your code. Try changing

    if ( post_password_required() ) {
    return __( 'There is no excerpt because this is a protected post.' );
    }

    to

    if ( post_password_required() ) {
       $content = get_the_password_form();
       return $content;
    }

    Tip: The blank white screen you get is because of a PHP error. It may be just a simple syntax error. To get an indication of what and where the error is, in wp-config.php, change false to true in this line:
    define('WP_DEBUG', false);

    It's usually near the bottom above '/* That's all, stop editing! Happy blogging. */'. Setting it as true is a slight security risk, so don't forget to restore the false value when you're done.

  11. 4795209
    Member
    Posted 6 months ago #

    I've used an Artisteer theme. Created a password protected page, worked fine. Then I added some test JavaScript and the password no longer protected access to the page. Once I removed the JavaScript and changed the password to a new one, it looks fine again and operated. I'm still learning JavaScript. Is this something similar and tied to using an Artisteer theme or something else?

  12. WPyogi
    Volunteer Moderator
    Posted 6 months ago #

    @4795209 - please don't hijack other people's threads - that's not cool here - looks like you have your own here:

    http://wordpress.org/support/topic/question-about-learning-javascript?replies=1

Reply

You must log in to post.

About this Topic

Tags

No tags yet.