• Resolved capitanjan

    (@capitanjan)


    I am looking to post a teaser to the post and have the post authenticated by password.

    That way i get the best from both worlds.

    Search engines can read the teaser… and only authenticated users either paid or unpaid are able to acess the post.

    Anybody has any hints??

Viewing 6 replies - 1 through 6 (of 6 total)
  • Nope. A lot of people would like that but I haven’t seen any working solution ??

    Using a plugin like my Head META Description could potentially solve the search engine side of things.

    As for posting a teaser before the password prompt, the goal is to do a bit of a runaround to the functionality hidden in the_content(). So you could locate this in your templates:

    <?php the_content(); ?>

    and modify it to:

    <?php
    $content = explode('<!--more-->', $post->post_content, 2);
    $teaser = $content[0];
    if( !empty($content[1]) && !empty($post->post_password) && (stripslashes($_COOKIE['wp-postpass_'.COOKIEHASH]) != $post->post_password) ) {
    echo apply_filters('the_content', $teaser);
    }

    the_content();
    ?>

    Keep in mind this assumes you’ve added the ‘more’ quicktag (<!--more-->) to your post. Anything before it would be considered the ‘teaser.’

    EDIT: Fixed a glaring hole in my if statement. Now you can admire it…

    Oh say now… isn’t that sneaky?

    I don’t need it, but I can sure admire it!

    Thread Starter capitanjan

    (@capitanjan)

    Thank you VERY much. I can only find the_content in archive.php

    Am i missing any other file?

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    capitanjan: You should, at a minimum, have the_content in index.php. Probably you’ll have it in archive, single, maybe some category files, etc. Check all the PHP files in your theme. Every theme will be different, of course, but this is the usual approach.

    Thread Starter capitanjan

    (@capitanjan)

    You guys rock!! Thanks a lot

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Teaser and password Authentication’ is closed to new replies.