我为域名安装了WordPress。当我使用这个域名时会指向index.php
在我的模板中。我想为这个域名显示一个正在建设的页面,但另一方面我还想继续工作index.php
在我的模板中。
如何显示一个域的正在构建的页面,同时仍然能够在index.php上工作?
5 个回复
最合适的回答,由SO网友:fuxia 整理而成
您可以筛选template_include
并为未登录的用户提供一个特殊文件:
/* Plugin Name: T5 Under Construction */
add_filter( \'template_include\', \'t5_uc_template\' );
function t5_uc_template( $template )
{
$uc_template = dirname( __FILE__ ) . \'/under-construction.php\';
if ( ! is_user_logged_in() )
return $uc_template;
if ( ! current_user_can( \'administrator\' ) )
return $uc_template;
return $template;
}
文件under-construction.php
可以是普通HTML文件;它不必是PHP文件。SO网友:5hahiL
最简单的解决方法是在新的index.html
文件,服务器应读取.html
在.php
SO网友:Kailash Yadav
您可以根据IP地址和Htaccess文件进行限制。
<Files index.php>
Order Deny,Allow
Deny from all
Allow from 12.34.56.78
</Files>
其中,12.34.56.78是您的ip地址。SO网友:Kuldip
使用维护模式插件。激活它。一旦激活以管理员身份登录,您只能查看您的网站。其他用户可以看到维护消息。
SO网友:Devesh Sharma
最简单的方法是使用维护或即将推出的插件。安装插件需要一两分钟的时间,你就可以开始了。
结束