• Resolved lonewolfonline

    (@lonewolfonline)


    Hi,

    I have a page template which displays content on the left and thumbnails on the right. Thumbnails are generated using a custom php function and data extracted from the custom fields.

    When I password protect the post the content is correctly hidden using the_content – please enter password, but I need some code for the thumbnails.

    Something like:

    IF password_protected AND password_entered_correct
    {
    show thumbnails
    }
    else
    {
    please enter password
    }

    Anybody know how to do this? Is there a global for the password which I can compare to post_password?

    I am currently using

    if (empty($post->post_password)) {

    to hide content, but using this it never gets shown.

    Thanks in advance

    Tim

Viewing 1 replies (of 1 total)
  • Thread Starter lonewolfonline

    (@lonewolfonline)

    Having trawled through some of the core files if found this way for testing. Hopefully this will be helpful to somebody else.

    if ( (empty($post->post_password)) || ($_COOKIE['wp-postpass_'.COOKIEHASH] == $post->post_password) )
      {
    show thumbnails
    }
    else
    {
    please enter password
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Post passwords and custom functions’ is closed to new replies.