Home Forums WoodMart support forum Add content to the sign in sidebar?

Add content to the sign in sidebar?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #540138

    waynep16
    Participant

    Here is where I want to show my content https://snipboard.io/SDdA17.jpg

    How can I hook in to that position?

    #540257

    Hung Pham
    Keymaster

    Hi 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,

    #540333

    waynep16
    Participant

    We 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.
    #540386

    Hung Pham
    Keymaster

    Hi 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,

    #566267

    ahe.badri
    Participant

    Thank you Hung,
    What if I want to remove the login form and Create an account and keep only my HTML Block?

    Thanks again

    #566397

    Hung Pham
    Keymaster

    Hi 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,

    #566436

    ahe.badri
    Participant

    It didn’t work.
    Do I need to be adding any of the codes you wrote above?

    #566438

    ahe.badri
    Participant

    I 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.
    #566584

    Hung Pham
    Keymaster

    Hi ahe.badri,

    Above code aims to remove default side menu’s content. According to the screenshot, you added the <p> tag inside create-account-question section, so it will be removed as well.

    Regards,

Viewing 9 posts - 1 through 9 (of 9 total)