Click-to-Call Bar on Mobile
Shows a full-width "Call us now" bar fixed to the bottom of the screen on phones, so mobile visitors can call your business with one tap.
Opens WPIDE on
Code
add_action( 'wp_footer', function () {
$phone = ''; // For example '+1 555 010 0000'.
$label = 'Call us now';
if ( '' === trim( $phone ) ) {
return;
}
printf(
'<a class="wpide-call-bar" href="%1$s">📞 %2$s</a><style>.wpide-call-bar{display:none;}@media (max-width:767px){.wpide-call-bar{display:block;position:fixed;left:0;right:0;bottom:0;z-index:9999;padding:14px;background:#00a32a;color:#fff !important;text-align:center;font-weight:600;text-decoration:none;}body{padding-bottom:52px;}}</style>',
esc_url( 'tel:' . preg_replace( '/[^0-9+]/', '', $phone ) ),
esc_html( $label )
);
} );
Notes
Set $phone and $label. The bar only appears on screens narrower than 768px.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.