I want to echo the url which includes an onlick property. Here is my code below:
function royal_sidebutton_body_tag_html() {
// get plugin option array and store in a variable
$royal_sidebutton_plugin_option_array = get_option( 'royal_sidebutton_plugin_options' );
// fetch individual values from the plugin option variable array
$royal_sidebutton_text_for_tab = $royal_sidebutton_plugin_option_array[ 'text_for_tab' ];
$royal_sidebutton_tab_url = /*$royal_sidebutton_plugin_option_array[ 'tab_url' ]; */ 'https://www.example.co.uk">';
$royal_sidebutton_target_blank = $royal_sidebutton_plugin_option_array[ 'target_blank' ];
// set the page target
if ($royal_sidebutton_target_blank == '1') {
$royal_sidebutton_target_blank = ' target="_blank"';
}
// Write HTML to render tab
echo '<a href="' . esc_url( $royal_sidebutton_tab_url ) . '"' . $royal_sidebutton_target_blank . '><div id="royal_sidebutton_tab" class="royal_sidebutton_contents royal_sidebutton_left">' . esc_html( $royal_sidebutton_text_for_tab ) . '</div></a>';
}
I have tried to add
a href="//www.example.co.uk/login.aspx" target="_blank" title="Login" onclick="popitup(); return false;"
to the variable "$royal_sidebutton_tab_url" but it does not work. It just adds it to the link.