Home › Forums › WoodMart support forum › Change ‘create an account’ redirect link in sidebar
Change ‘create an account’ redirect link in sidebar
- This topic has 5 replies, 2 voices, and was last updated 1 year, 11 months ago by Luke Nielsen.
-
AuthorPosts
-
December 28, 2022 at 6:29 am #431661
julian.connettParticipantHi there,
I was wondering if there was a way to change the ‘Create an Account’ in the sidebar when selecting the login/register button? https://www.loom.com/i/880f74f9a35e412e93e29f6fba4d0ccc
I would like to send them to /create-an-account/ so that I can explain the inclusions in the free vs premium account options before they sign up.
Thanks in advance
December 28, 2022 at 12:29 pm #431741
Luke NielsenKeymasterHello,
Please add the below code to the
functions.php
file in your child theme for changing the redirect.add_filter( 'woodmart_my_account_side_login_form_redirect', function () { return get_permalink('there is ID of the page'); });
In the meantime, feel free to ask me any questions you may have.
Kind Regards
December 30, 2022 at 3:11 am #432189
julian.connettParticipantThanks for that. However that did not seem to work? Here is a shot of the child theme functions.php: https://www.loom.com/i/f8610bb2d4ac4feba23bdc8c74cf4384
I also tried inserting the post ID ‘8555’ into the above code but it didn’t work either?
December 30, 2022 at 12:36 pm #432248
Luke NielsenKeymasterHello,
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
December 31, 2022 at 12:32 pm #432389
julian.connettParticipantThanks Luke,
Sorry, I am a little new to the code side of things. With the screenshot attached, how/where should I put the link in?
The URL for the page is: https://julianc16.sg-host.com/create-an-account/ (although this will change once primary domain is set. This is just. devsite.
Thanks in advance
January 3, 2023 at 11:20 am #432766
Luke NielsenKeymasterHello,
You need to paste the ID of the page in the above code, the ID you can find via Dashboard -> Pages (https://prnt.sc/0FH3PLwva8WC).
Kind Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register