是否存在允许您通过用户名/登录保护某些页面的WordPress插件?
问题描述:
我有10页,其中4应该可以通过登录用户访问。是否存在允许您通过用户名/登录保护某些页面的WordPress插件?
是否有插件存在以密码保护这些页面?理想情况下,您可以登录一次,然后查看所有这些受保护的页面。
我已经Google了一下,但一直没能找到让你保护个别页面的东西,只有整个WordPress平台。
是否有这样的事情存在,如果有多个,这是你的经验最好的?
谢谢
答
您可以使用Membership插件。他们中的大多数都花钱。谷歌搜索出现了一个名为MemberWing的免费搜索,但我没有尝试过,也不知道它有多好。
通常会员插件将处理注册和访问控制。如果您认为这是过度杀毒,那么您可以仅使用Custom Page Template来关注内容保护。下面,我附加了一个通用的WordPress页面模板,它将隐藏来宾的内容。它基于WordPress的旧默认主题。如果用户未登录,则会显示一条消息,告知他们无法以访客身份访问内容。
<?php
/*
Template Name: Protected Content
*/
get_header(); ?>
<div id="content" class="narrowcolumn" role="main">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<div class="entry">
<?php
if(is_user_logged_in()) {
the_content('<p class="serif">Read the rest of this page »</p>');
}
else {
echo "You must be logged in to access this content!";
}
?>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
</div>
</div>
<?php endwhile; endif; ?>
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
<?php comments_template(); ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
答
私人职位应该做你想做的。你不应该需要一个插件。
我还是新来的WordPress。用户如何注册 - 他们可以从前端完成吗?谢谢。 – alex 2010-09-01 04:10:47
管理员设置注册策略。这包括用户可以注册的位置,访问时间,以及无需其他人调整权限即可获得的级别。从我所看到的,私人帖子只对没有登录的用户是私人帖子。一旦他们登录,他们可以阅读私人帖子。 – BillThor 2010-09-01 22:03:17