wordpress页面内的PHP区域

Cel*_* Jr 4 php wordpress joomla

我有一个公司页面使用Joomla,在其中开发了一个用PHP开发的管理区域.只有拥有一定的特权,partner并且partner_employees可以访问该区域.

我需要Wordpress使用登录来迁移前端站点,并在受限区域保持相同的行为Wordpress.

可能吗?

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

如何在Wordpress页面上指向该区域的链接?

Ama*_*tap 5

如果您只是想像开发中wp那样呈现受限区域而不是为了集成另一个框架(在您的情况下),您可以通过以下方式实现:My AccountPHPJoomlawp

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

其次,创建一个wp page使用您创建templatelink为此页面设置的menu.参考: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; ?>
Run Code Online (Sandbox Code Playgroud)

注意:您可以在许多嵌套中破坏您的受限区域逻辑, template parts并可以根据您的main template要求在您的内部使用它们.将它们放在您的活动主题目录下: wp-content/themes/twentyfourteen/myaccount

<?php get_sidebar(); ?>
<?php get_template_part( 'featured-content' ); ?>
<?php get_footer(); ?>
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助.