Teaser and password Authentication
-
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!
Thank you VERY much. I can only find the_content in archive.php
Am i missing any other file?
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.
You guys rock!! Thanks a lot
The topic ‘Teaser and password Authentication’ is closed to new replies.