Home › Forums › WoodMart support forum › Change ‘create an account’ redirect link in sidebar › Reply To: Change ‘create an account’ redirect link in sidebar
December 30, 2022 at 12:36 pm
#432248
Luke Nielsen
Keymaster
Hello,
Please remove the old custom code and paste the below to the functions.php
file in your child theme.
if ( ! function_exists( 'woodmart_sidebar_login_form' ) ) {
function woodmart_sidebar_login_form() {
if ( ! woodmart_woocommerce_installed() || is_account_page() ) {
return;
}
$settings = whb_get_settings();
$login_side = isset( $settings['account'] ) && $settings['account']['login_dropdown'] && $settings['account']['form_display'] == 'side';
$account_link = get_permalink( get_option( 'woocommerce_myaccount_page_id' ) );
$page_id = woodmart_get_the_ID() ? woodmart_get_the_ID() : get_option( 'woocommerce_myaccount_page_id' );
$redirect_url = apply_filters( 'woodmart_my_account_side_login_form_redirect', get_permalink( $page_id ) );
$wrapper_classes = '';
if ( 'light' === whb_get_dropdowns_color() ) {
$wrapper_classes .= ' color-scheme-light';
}
$position = is_rtl() ? 'left' : 'right';
$wrapper_classes .= ' wd-' . $position;
if ( ! $login_side || is_user_logged_in() ) {
return;
}
woodmart_enqueue_inline_style( 'header-my-account-sidebar' );
woodmart_enqueue_inline_style( 'woo-mod-login-form' );
?>
<div class="login-form-side wd-side-hidden<?php echo esc_attr( $wrapper_classes ); ?>">
<div class="wd-heading">
<span class="title"><?php esc_html_e( 'Sign in', 'woodmart' ); ?></span>
<div class="close-side-widget wd-action-btn wd-style-text wd-cross-icon">
<a href="#" rel="nofollow"><?php esc_html_e( 'Close', 'woodmart' ); ?></a>
</div>
</div>
<?php if ( ! is_checkout() ) : ?>
<?php woocommerce_output_all_notices(); ?>
<?php endif; ?>
<?php woodmart_login_form( true, $redirect_url, false, true, $redirect_url ); ?>
<div class="create-account-question">
<p><?php esc_html_e( 'No account yet?', 'woodmart' ); ?></p>
<a href="<?php echo esc_url( get_permalink('There is ID of the Page') ); ?>" class="btn btn-style-link btn-color-primary create-account-button"><?php esc_html_e( 'Create an Account', 'woodmart' ); ?></a>
</div>
</div>
<?php
}
add_action( 'woodmart_before_wp_footer', 'woodmart_sidebar_login_form', 160 );
}
If you ever need to reach out to me, please do not hesitate to do so.
Kind Regards