我想添加登录和注册的快捷码。我已经有了这个短代码,我想知道的是如何添加它以进行登录和注册?
if (!function_exists(\'techstore_tiny_account\')) {
function techstore_tiny_account($icon = false) {
$login_url = \'#\';
$register_url = \'#\';
$profile_url = \'#\';
$logout_url = wp_logout_url(get_permalink());
if (techstore_has_woocommerce()) { /* Active woocommerce */
$myaccount_page_id = get_option(\'woocommerce_myaccount_page_id\');
if ($myaccount_page_id) {
$login_url = get_permalink($myaccount_page_id);
$register_url = $login_url;
$profile_url = $login_url;
}
} else {
$login_url = wp_login_url();
$register_url = wp_registration_url();
$profile_url = admin_url(\'profile.php\');
}
$redirect_to = (is_ssl() ? \'https://\' : \'http://\') . $_SERVER[\'HTTP_HOST\'] . $_SERVER[\'REQUEST_URI\'];
$result = \'\';
if (!is_user_logged_in()) {
$span = $icon ? \'<span class="pe7-icon pe-7s-lock"></span>\' : \'\';
$result .= \'<li class="menu-item color"><a href="\' . esc_url($login_url) . \'" title="\' . esc_html__(\'Login or Register\', \'techstore-theme\') . \'">\' . $span . esc_html__(\'Login or Register\', \'techstore-theme\') . \'</a></li>\';
} else {
$span1 = $icon ? \'<span class="pe7-icon pe-7s-user"></span>\' : \'\';
$span2 = $icon ? \'<span class="pe7-icon pe-7s-unlock"></span>\' : \'\';
$result .=
\'<li class="menu-item"><a href="\' . esc_url($profile_url) . \'" title="\' . esc_html__(\'My Account\', \'techstore-theme\') . \'">\' . $span1 . esc_html__(\'My Account\', \'techstore-theme\') . \'</a></li>\' .
\'<li class="menu-item"><a class="nav-top-link" href="\' . esc_url($logout_url) . \'" title="\' . esc_html__(\'Logout\', \'techstore-theme\') . \'">\' . $span2 . esc_html__(\'Logout\', \'techstore-theme\') . \'</a></li>\';
}
return $result;
}
}