I've been trying to figure this out for a few days now and I've now come to the understanding I need help.
I've never worked with the wordpress customizer but have been recently interested in adding additional text fields and image uploads to my themes I customize (I'm finding this quite difficult as not only do I need to learn the code for the customizer but then also have to figure out how to add it to a genesis theme - which there aren't too many articles on).
I'm trying to remove the "http://" from my url in my "Email Link" text box in a new panel I made.
I have the email text box and then the link where I've then added it to link to it (and the phone and possibly an address down the road).
So I've created the panel, then the text boxes. This is my email link text box (I haven't included the whole thing as there are many other pieces to it and I'm not sure that needs to be displayed as it's just the linking I need help on):
// EMAIL $wp_customize->add_setting( 'header_utility_right_email_block', array( 'default' => '', 'sanitize_callback' => 'sanitize_text' ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'header_utility_right_email_block', array( 'label' => __( 'Email', 'CHILD_THEME_NAME' ), 'section' => 'utility_bar_right', 'settings' => 'header_utility_right_email_block', 'type' => 'text' ) ) ); // EMAIL LINK $wp_customize->add_setting( 'header_utility_right_email_block_link', array( 'default' => '', 'sanitize_callback' => 'sanitize_text' ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'header_utility_right_email_block_link', array( 'label' => __( 'Email Link', 'CHILD_THEME_NAME' ), 'section' => 'utility_bar_right', 'settings' => 'header_utility_right_email_block_link', 'type' => 'text' ) ) );
then I have my phone and it in a function (for genesis) plus a lot more but I'll just give you the individual calling of it for the email and email link:
if( get_theme_mod( 'header_utility_right_email_block') ) : ?> <div class='theme-utility-bar-right-email'> <a href="mailto:<?php echo esc_url( get_theme_mod( 'header_utility_right_email_block_link', '$protocols = null' ) ); ?>"><?php echo get_theme_mod( 'header_utility_right_email_block');?></a> </div> <?php endif;
All works great! Other than the link itself for the email returns a mailto:http://firstname.lastname@example.org instead of mailto:email@example.com.
Is there a way to remove the http://? I've looked for some articles and found the $protocol addition but not sure how to use it and if it's even the right way to go about this. I'm not really a programmer so need help with the first jump on the functions and suck but then from there usually get the hang of it.
Any help on making this "http://" not default would be great!