js in Wordpress functions.php | how to open url in new tab

Viewed 22

how can i open the url at the top in a new tab? thanks! i am not sure where to add it. and actually my questions is pretty simple, but i have to write more text since stackoverflow wants me to have a certain amount of text that is not code. so here we go. i hope you are all doing great.

    $phone_number = '01626513155';
    $content = 'Wie können wir dir helfen?';

    $link = sprintf(
        'https://api.whatsapp.com/send/?phone=%2B491626513155&text&type=phone_number&app_absent=0',
        $phone_number, rawurlencode($content)
    );
    $style = '.lava_whatsapp {
        border: 1px solid #249235;
        border-radius: 10px;
        padding: 10px 30px 10px 55px;
        background-color: #FFFFFF;
        color: #249235;
        text-decoration: none;

        background: url(/wp-content/uploads/whatsapp_logo_green.svg);
        background-repeat: no-repeat;
        background-size: 30px 30px;
        background-repeat: no-repeat;
        background-position: 10px center;
    }

    .lava_whatsapp:hover {
        border: 0;
        background-color: #249235;
        color: #FFFFFF;
    }';

    echo '<style>'.$style.'</style>';
    echo '<a href="'.$link.'" class="lava_whatsapp">Fragen zum Produkt?</a>';
}

add_action( 'woocommerce_single_product_summary', 'lava_add_whatsapp_button', 30 );```
0 Answers
Related