Home › Forums › WoodMart support forum › Add content to the sign in sidebar?
Add content to the sign in sidebar?
- This topic has 8 replies, 3 voices, and was last updated 6 months, 4 weeks ago by Hung Pham.
-
AuthorPosts
-
February 14, 2024 at 7:55 pm #540138
waynep16ParticipantHere is where I want to show my content https://snipboard.io/SDdA17.jpg
How can I hook in to that position?
February 15, 2024 at 11:04 am #540257
Hung PhamKeymasterHi waynep16,
Thanks for reaching to us.
I kindly recommend you to use HTML Block feature to add content. Here is documentation about HTML Blocks:
https://xtemos.com/docs-topic/html-blocks-usage/Then, add below code to functions.php in Child theme
add_action('woocommerce_login_form_end', function () { echo do_shortcode('[html_block id="12345"]'); });
Regards,
February 15, 2024 at 12:18 pm #540333
waynep16ParticipantWe are almost there… the hook does under log In form, can we get a way to make content under the .create-account-question div like this? https://s3.amazonaws.com/i.snag.gy/oc3dSm.jpg
Also what is the best way to change the text “No account yet?” to something else, i thought this text was changeable in theme control panel but it is not 🙁
- This reply was modified 10 months ago by waynep16.
February 15, 2024 at 2:00 pm #540386
Hung PhamKeymasterHi waynep16,
Please remove above Custom code and use below one then you place your content at the end https://prnt.sc/j39MiRCyioXQ
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 woocommerce<?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( add_query_arg( 'action', 'register', $account_link ) ); ?>" class="btn btn-style-link btn-color-primary create-account-button"><?php esc_html_e( 'Create an Account', 'woodmart' ); ?></a> <p> Place your content here </p> </div> </div> <?php } add_action( 'woodmart_before_wp_footer', 'woodmart_sidebar_login_form', 200 ); }
Regards,
May 17, 2024 at 3:19 pm #566267
ahe.badriParticipantThank you Hung,
What if I want to remove the login form and Create an account and keep only my HTML Block?Thanks again
May 18, 2024 at 9:08 am #566397
Hung PhamKeymasterHi ahe.badri,
Please add the following Custom CSS code to Theme Settings > Custom CSS > Global Custom CSS:
.login-form-side .title, .login-form-side form.login:not(.hidden-form), .login-form-side .create-account-question{ display: none !important; }
Regards,
May 18, 2024 at 1:15 pm #566436
ahe.badriParticipantIt didn’t work.
Do I need to be adding any of the codes you wrote above?May 18, 2024 at 1:25 pm #566438
ahe.badriParticipantI tried adding the code, now nothing is showing even my content, I want to place HTML Block or Shortcode there.
Attachments:
You must be logged in to view attached files.May 20, 2024 at 8:09 am #566584
Hung PhamKeymasterHi ahe.badri,
Above code aims to remove default side menu’s content. According to the screenshot, you added the
<p>
tag insidecreate-account-question
section, so it will be removed as well.Regards,
-
AuthorPosts
- You must be logged in to create new topics. Login / Register