2016-08-24 32 views
4

我有一个使用Joomla开发的公司页面,里面用PHP开发了一个行政区域。只有具有特定权限的用户partnerpartner_employees才能访问此区域。在wordpress页面内的PHP区域

我需要将主站点迁移到Wordpress,并使用登录名Wordpress在受限区域保持相同的行为。

可能吗?

我应该从哪个限制区域放置目录?

如何把链接指向Wordpress页面指向这个区域?

回答

5

如果你只是想呈现wpMy AccountPHP开发的禁区,而不是与wp整合(在你的情况Joomla)另一个框架,你可以简单地实现,通过:

首先,创建wp templateincludes禁区逻辑。参考文献:https://developer.wordpress.org/themes/basics/template-files/ https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/

其次,使用创建的template创建wp page并在menu设置link此页面。参考文献:https://codex.wordpress.org/Pages

现在,如果你想与WordPress来处理身份验证为好,要么你可以使用许多可用的插件在那里,如:

  1. https://wordpress.org/plugins/advanced-access-manager/

  2. https://wordpress.org/plugins/wpfront-user-role-editor/

或者你可以自己定制代码,知道更多你可以在这里参考:https://codex.wordpress.org/Roles_and_Capabilities

你的模板文件可能看起来像(作为起点):

<?php 
/** 
* Template Name: My Account Page Temp 
* 
* @package WordPress 
* @subpackage Twenty_Fourteen 
* @since Twenty Fourteen 1.0 
*/ 

<?php if (is_user_logged_in() && current_user_can($capability)): ?> 

//render your restricted area content   

<?php else : ?> 

// Redirect him for login 

<?php endif; ?> 

注意:您可以打破你的禁区逻辑的嵌套 template parts,可以每 你main template为中使用它们要求。把它们放在你的活动主题目录下: wp-content/themes/twentyfourteen/myaccount

<?php get_sidebar(); ?> 
<?php get_template_part('featured-content'); ?> 
<?php get_footer(); ?> 

希望这有助于。

+1

提示:'else:' - than --' endif;' – Spooky

相关问题