分享

WordPress插件发布:隐藏内容登陆后可见

 玉屏风散很好喝 2014-09-22

Languages: English · 中文(简体)

请不要在登录状态下测试隐藏效果!

     应 流年 网友的请求,特地研究了一下在WordPress博客中,如何实现隐藏文章的部分内容,使得用户在登陆后才可以看到。其实这个难度不是很大,WordPress提供了很多的编程接口,可以很方便的实现很多功能,现在我使用WordPress Shortcode API,也就是简码,做了一个插件,基本上可以满足文章隐藏内容,登陆后可见的需求。之前也有人开发过相关的插件,不过那是隐藏文章全部内容,不能做到只隐藏部分内容,可以说今天我做的这个插件更加灵活一些。

     1.0版推出后不久,网友yken89提了一个非常有建设意义的意见。2.0版本采纳该网友的建议,添加了新的标签

1
<!--loginview start-->hidden contents.<!--loginview end-->

并在HTML模式下,添加了loginview按钮,方便用户添加隐藏内容。2.0版借鉴了WordPress插件Easy2hide的部分代码。升级至2.0版后,原来的标签[loginview]仍然有效。3.0版本修正了对WordPress 3.3的支持。

 

名称:Login to view all
版本:3.1
作者:Ludou
更新:2013-12-20
功能:您可以隐藏文章的部分内容,使得用户必须登录,才能浏览。
下载:WordPress 官方下载
WordPress最低版本要求:WordPress 2.7 及更高版本

 

安装方法:

1. 下载插件,解压缩,你将会看到一个文件夹login-to-view-all,然后将其放置到插件目录下,插件目录通常是 `wp-content/plugins/`
2. 在后台对应的插件管理页激活该插件Login to view all
4. 完成

 

使用说明:
1. 在WordPress后台编辑文章的时候,切换到HTML模式,选中你要隐藏的内容,点击按钮 loginview 即可用

1
<!--loginview start-->

1
<!--loginview end-->

将隐藏内容括起来;使用这个标签的好处是,你停用本插件后,该标签不会被显示出来。

2. 如果你不喜欢HTML代码模式,可以使用 [loginview] 和 [/loginview] 将你想要隐藏的内容括起来,该标签支持可视化模式和HTML编辑模式。你的文章内容应该像这样子:

1
[loginview]这里是你要隐藏的内容[/loginview]

3. 这样未登录的用户浏览文章的时候,将无法阅读隐藏的内容。

 

效果预览图:

隐藏内容登陆后可见

 

Plugin name:Login to view all
Version: 3.0
Author: Ludou
Update: 2012-02-11
Description:Login to view all is an plugin designed to help you add hidden contents of your post. The hidden contents are only visible for the visitor who are logged in.
Download: From

Installation:

  1. Upload to your plugins folder, usually `wp-content/plugins/` and unzip the file, it will create a `wp-content/plugins/login-to-view-all/` directory.
  2. Activate the plugin on the plugin screen.
  3. Done

How to use?

1. You can switch to HTML editor and click the "loginview" button, to put your words needed to hide between "<!–loginview start–>" and "<!–loginview end–>". like:

1
<!--loginview start-->hidden contents.<!--loginview end-->

This has the advantage of that if you disable this plugin, the tag <!–loginview start–> and <!–loginview end–> will still not be displayed.

2. Or you can use it like that in your blog post :

1
[loginview]hidden contents.[/loginview]

[loginview] can be use in the visual editor and HTML editor.

Screenshots

Login to view all1


 

Login to view all2


    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多