wordpress whats app custome code


function.php file add this code

function register_fields()
register_setting(‘general’, ‘my_WhatsApp_field’, ‘esc_attr’);
add_settings_field(‘my_WhatsApp_field’, ‘<label for=”my_WhatsApp_field”>’.__(‘My WhatsApp Field’ , ‘my_WhatsApp_field’ ).'</label>’ , ‘print_first_field’, ‘general’);

function print_first_field()
$value = get_option( ‘my_WhatsApp_field’, ” );
echo ‘<input type=”text” id=”my_WhatsApp_field” name=”my_WhatsApp_field” value=”‘ . $value . ‘” />’;

add_filter(‘admin_init’, ‘register_fields’);

below code is pest on below body tag header.php

<?php $my_WhatsApp_field = get_option( ‘my_WhatsApp_field’, ” );?>
<div style=”width: 80px; height: 80px; margin-top: 150px; z-index: 999; margin-right: 0px; margin-left: auto; position:fixed; top: 10px; right:0;” class=”calls” align=”center”><a href=”https://wa.me/<?php echo $my_WhatsApp_field;?>” title=”<?php echo $my_WhatsApp_field;?>”><img src=”https://www.navitatours.com/assets/designer/themes/default/images/whatsaap.png” alt=”Whatsapp” title=”<?php echo $my_WhatsApp_field;?>”></a></div>

going to general setting and look below page one text box add enter hear whats app number

Previous articlephp machine test question
Next articlehtaccess tip