HideThis..problem with new version of WordPress.
-
Hi,
I have seen the plugin code, and it seems quite simple. But, it doesn’t work on the new version of 2.2 WP.
Does anyone know how to make the code working. I really need that, here’s the code:<?php
/*
Plugin Name: HideThis
Plugin URI: https://www.edwards.org/tags/Wordpress
Description: Hides parts of posts from readers who are not logged in. Begin hidden content with <!–hidethis–> and end hidden content with <!–/hidethis–>
Version: 1.0.1
Author: Mark Edwards
Author URI: https://www.edwards.orgCopyright ? 2006 – Mark Edwards
Drop it in your plugins dir and activate. Then wrap the text to be hidden with <!–hidethis–> and <!–/hidethis–>
Example of post with hidden content:
This is a test post I wrote to see if this plugin works.
<!–hidethis–>
this text will be hidden if a reader isn’t logged in
<!–/hidethis–>
And so this is the end of the post.*/
add_filter(‘the_content’, ‘hide_some_content’);
function hide_some_content($content) {
global $current_user, $user_ID;if (($current_user->id == 0) && ($user_ID == 0)){
$b = strpos($content, ‘<!–hidethis–>’);
$e = strpos($content, ‘<!–/hidethis–>’);$pre = substr($content,0,$b);
$suf .= substr($content,$e,strlen($content));return $pre.$suf;
} else { return $content; }
}
?>
- The topic ‘HideThis..problem with new version of WordPress.’ is closed to new replies.