Aşağıya yazdığım kod bir whatsapp iconu gibi sitenin sağında duruyor. Bilgisayarda iken tıklandığında whatsapp webe otomatik olarak belirtilen numaradan mesaj atıyor. Mobilden ise direk uygulamadan belirtilen numaraya istediğin mesajı atıyor. Şimdi ben bu kodları alıp OPENCART ta kullanmak istiyorum. Bu kodların neresini nasıl alırsam sağlıklı bir şekilde kod çalışır? yardımcı olursanız sevinirim. Şimdiden teşekkür ederim.

/*
Plugin Name: WhatsApp Chat WP
Plugin URI: https://caporalmktdigital.com.br/plataformas/plugin-whatsapp-chat-wp/
Description: Inicie uma conversa no whatsapp direto de seu site.
Author: Alexandre Caporal
Author URI: https://caporalmktdigital.com.br/
Version: 1.5
License: GPLv2
*/

if ( ! defined( 'ABSPATH' ) )
exit;

function whatsapp_chat_menu() {
add_options_page('WhatsApp Chat Settings', 'WhatsApp Chat', 'administrator', 'whatsapp-chat-settings', 'whatsapp_chat_settings_page');
}
add_action('admin_menu', 'whatsapp_chat_menu');

function whatsapp_chat_settings_page() { ?>

WhatsApp Chat WP


Inicie uma conversa no whatsapp direto de seu site.



settings_fields( 'whatsapp-chat-settings' );
do_settings_sections( 'whatsapp-chat-settings' );
?>

<script>
jQuery(document).ready(function($){
var custom_uploader;
$('#whatsapp_chat_upload_image_button').click(function(e) {
e.preventDefault();
//If the uploader object has already been created, reopen the dialog
if (custom_uploader) {
custom_uploader.open();
return;
}
//Extend the wp.media object
custom_uploader = wp.media.frames.file_frame = wp.media({
title: 'Choose Image',
button: {
text: 'Choose Image'
},
multiple: true
});
//When a file is selected, grab the URL and set it as the text field's value
custom_uploader.on('select', function() {
console.log(custom_uploader.state().get('selection').toJSON());
attachment = custom_uploader.state().get('selection').first().toJSON();
$('#whatsapp_chat_upload_image').val(attachment.url);
});
//Open the uploader dialog
custom_uploader.open();
});
});
</script>




























Ex. +5512999999999
Note que é preciso preencher o número no modelo internacional +código-do-pais (55 para Brasil) DDD de sua cidade e número completo.


Ex. Olá, gostaria de saber mais sobre seu serviço/produto.

' : ' />'; ?>

' : ' />'; ?>



' : ' />'; ?>
Agradecemos se puder contribuir com a agência Caporal Mkt Digital, estamos sempre em busca de desenvolver novas ferramentas e estratégias gratuitas para os pequenos negócios online.



Plugin desenvolvido por Agência de planejamento estratégico digital




function whatsapp_chat_settings() {
register_setting( 'whatsapp-chat-settings', 'whatsapp_chat_page' );
register_setting( 'whatsapp-chat-settings', 'whatsapp_chat_msg' );
register_setting( 'whatsapp-chat-settings', 'whatsapp_chat_hide_button' );
register_setting( 'whatsapp-chat-settings', 'whatsapp_chat_left_side' );
register_setting( 'whatsapp-chat-settings', 'whatsapp_chat_upload_image' );
register_setting( 'whatsapp-chat-settings', 'whatsapp_chat_upload_image_button' );
register_setting( 'whatsapp-chat-settings', 'whatsapp_chat_powered_by' );
}
add_action( 'admin_init', 'whatsapp_chat_settings' );

function whatsapp_chat_deactivation() {
delete_option( 'whatsapp_chat_page' );
delete_option( 'whatsapp_chat_msg' );
delete_option( 'whatsapp_chat_hide_button' );
delete_option( 'whatsapp_chat_left_side' );
delete_option( 'whatsapp_chat_upload_image' );
delete_option( 'whatsapp_chat_upload_image_button' );
delete_option( 'whatsapp_chat_powered_by' );
}
register_deactivation_hook( __FILE__, 'whatsapp_chat_deactivation' );

function whatsapp_chat_dependencies() {
wp_register_script( 'whatsapp-chat-index', '', true );
wp_enqueue_script( 'whatsapp-chat-index' );
wp_register_style( 'whatsapp-chat-style', plugins_url('css/style.css', __FILE__) );
wp_enqueue_style( 'whatsapp-chat-style' );
}
add_action( 'wp_enqueue_scripts', 'whatsapp_chat_dependencies' );

//WP Img Uploader
function whatsapp_chat_admin_scripts() {
if (isset($_GET['page']) && $_GET['page'] == 'whatsapp-chat-settings') {
wp_enqueue_media();
wp_register_script('whatsapp-chat-admin-js',"");
wp_enqueue_script('whatsapp-chat-admin-js');
}
}
add_action('admin_enqueue_scripts', 'whatsapp_chat_admin_scripts');

function whatsapp_chat() { ?>

$whatsapp_chat_upload_image = get_option( 'whatsapp_chat_upload_image' );
if ( empty( $whatsapp_chat_upload_image ) ) $whatsapp_chat_upload_image = plugins_url( 'images/whatsapp-chat.png', __FILE__ );
?>

.whatsapp.com/send?phone=&text=', '_blank');">



}
add_action( 'wp_footer', 'whatsapp_chat', 10 );