I'm a WordPress beginner.
This is my first question in Stackoverflow.
I am using the theme (wp bootstrap starter) I want to add an action call button, I have managed to show the button and customize it from the wordpress customizer but I have not been able to with the URL for the button.
I also want that when there is no text in the button, it does not show it to me in the front-end
Can someone help me with this please, I really appreciate it.
This is the code i am using:
functions.php
$wp_customize->add_setting( 'header_banner_button_setting', array(
'default' => __( 'Button' ),
'sanitize_callback' => 'wp_filter_nohtml_kses',
) );
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'header_banner_button_setting', array(
'label' => __( 'Banner Button', 'wp-bootstrap-starter' ),
'section' => 'header_image',
'settings' => 'header_banner_button_setting',
'type' => 'text'
) ) );
header.php
<button>
<?php
if(get_theme_mod( 'header_banner_button_setting' )){
echo esc_attr( get_theme_mod( 'header_banner_button_setting' ) );
}else{
echo esc_html__('','wp-bootstrap-starter');
}
?>
</button>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…