/*
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() { ?>
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');">
Desenvolvido por Agência de planejamento estratégico digital
}
add_action( 'wp_footer', 'whatsapp_chat', 10 );