wordpress - 我如何将登录模式从主题库更改为其他插件 wordpress
问题描述
这是我的主题登录我想将其更改为其他插件而不影响主题我需要帮助
> <?php if(get_theme_mod('header_login_btn', true ) &&
> !is_user_logged_in()){
> $header_login_btn_text = get_theme_mod('header_login_btn_text', 'Login');
> $header_reg_btn_text = get_theme_mod('header_reg_btn_text', 'Sign Up');
> ?>
> <div class="skillate-header-login d-inline-block ml-4">
> <div class="header-login-wrap">
> <a data-toggle="modal" href="#modal-login">
> <?php echo esc_html($header_login_btn_text); ?>
> </a>
> <a data-toggle="modal" href="#modal-registration">
> <?php echo esc_html($header_reg_btn_text); ?>
> </a>
> </div>
> </div>
> <?php } ?>
解决方案
制作插件很简单。使用此代码,创建一个名为的文件夹whatever-name-you-want
并创建一个名为whatever-name-you-want.php
. 在该文件中添加此代码。您可以更改注释代码中的名称。
然后转到管理部分中的插件,然后单击激活魔术插件或您所称的任何名称。
/**
* Plugin Name: Magic Plugin
* Description: Magic Plugin performs magic.
* Plugin URI: http://example.com/magic-plugin
* Version: 2.3
* Author: Mr. Magic
* Author URI: http://example.com/
* Text Domain: magic-plugin
*
* @package Magic Plugin
*/
if(get_theme_mod('header_login_btn', true ) && !is_user_logged_in()){
$header_login_btn_text = get_theme_mod('header_login_btn_text', 'Login');
$header_reg_btn_text = get_theme_mod('header_reg_btn_text', 'Sign Up');
?>
<div class="skillate-header-login d-inline-block ml-4">
<div class="header-login-wrap">
<a data-toggle="modal" href="#modal-login">
<?php echo esc_html($header_login_btn_text); ?>
</a>
<a data-toggle="modal" href="#modal-registration">
<?php echo esc_html($header_reg_btn_text); ?>
</a>
</div>
</div>
<?php
}
推荐阅读
- java - 滚动时底部的添加到购物车按钮 - Shopify
- performance - 如何根据渲染时可用的值有条件地将组件添加到 JSF 组件树?
- java - Automatically spawns a code and get error
- c# - NopCommerce - Error with Search Box
- javascript - 带有翻转数字的数字倒计时动画
- android - BringToFront() 不适用于 ConstraintLayout
- r - 如何从 R 中的绘图元素中提取原始数据
- php - 如何链接到 ACF 关系“父级”
- tfs - 使用 TFS API 获取测试用例结果/结果
- python - 使用 postgresql 和 sql alchemy 在 python 中绑定聚合函数