Open link term and condition _ blank

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #683453
    Massimo BH
    Participant

    thank you

    #684236
    J. Davis
    Keymaster

    Hi Massimo,

    Thank you for your message however could you specify why do not you like default solution? Such method is widely used in other platforms and systems.
    Also there is target="_blank" attribute available in the link of terms and conditions by default. But there is also available a JS code that opens page content without opening it in new window.
    That JS is applied for link class mphb-terms-and-conditions-link so you can override function renderTermsAndConditions() and change class to something different e.g.

    
    add_action( 'wp_head', 'remove_renderTermsAndConditions' );
    function remove_renderTermsAndConditions(){
    remove_action( 'mphb_sc_checkout_form', array( '\MPHB\Views\Shortcodes\CheckoutView', 'renderTermsAndConditions' ), 60 );
    }
    
    add_action( 'mphb_sc_checkout_form', 'custom_renderTermsAndConditions', 60);
    	
    	function custom_renderTermsAndConditions(){
    		$termsPageId = MPHB()->settings()->pages()->getTermsAndConditionsPageId();
    		$termsHtml   = MPHB()->settings()->main()->getTermsAndConditionsText();
    
    		if ( !empty( $termsHtml ) ) {
    			?>
    			<section class="mphb-checkout-terms-wrapper mphb-checkout-section">
    				<div class="mphb-terms-and-conditions">
    					<?php echo $termsHtml; ?>
    				</div>
    				<p class="mphb-terms-and-conditions-accept">
    					<label>
    						<input type="checkbox" id="mphb_accept_terms" name="mphb_accept_terms" value="1" required="required" />
    						<?php
    							$termsPageUrl  = get_permalink( $termsPageId );
    							$termsPagelink = '<a href="' . esc_url( $termsPageUrl ) . '" target="_blank">' . _x( 'terms & conditions', 'I\'ve read and accept the terms & conditions', 'motopress-hotel-booking' ) . '</a>';
    
    							printf( _x( 'I\'ve read and accept the %s', 'I\'ve read and accept the <tag>terms & conditions</tag>', 'motopress-hotel-booking' ), $termsPagelink );
    						?>
    						<abbr title="<?php _e( 'Required', 'motopress-hotel-booking' ); ?>">*</abbr>
    					</label>
    				
    
    			</section>
    			<?php
    		}
    	}
    #689073
    Massimo BH
    Participant

    Ciao Davis,
    Thank you for your precious help!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.