Skip to content

Instantly share code, notes, and snippets.

@PUYUP
Created November 13, 2025 01:53
Show Gist options
  • Select an option

  • Save PUYUP/4a7d46d7ddb502b9ce615eee405972fd to your computer and use it in GitHub Desktop.

Select an option

Save PUYUP/4a7d46d7ddb502b9ce615eee405972fd to your computer and use it in GitHub Desktop.
// masukkan ini kedalam functions.php child theme tepat didalam function zox_news_child_enqueue_styles() {}
// tujuan penambahan ini adalah untuk memamnggil file js custom
wp_enqueue_script( 'zox-news-child-script', get_stylesheet_directory_uri() . '/js/ln-child.js', array('jquery'), null, true );
// kemudian buat file javascript baru didalam folder /wp-content/themes/zox-news-child/js/ln-child.js
// paste ini kedalamnya
jQuery(document).ready(function($) {
$(document).on('click', '.cta-wa a', function() {
var phoneNumber = '6282329015769'; // Ganti dengan nomor WhatsApp tujuan
var pageUrl = window.location.href;
var message = `[LH.BLOG] - Halo, saya mengunjungi blog LindungiHutan tentang ${pageUrl} dan ingin bertanya.`;
var waLink = `https://api.whatsapp.com/send/?phone=${phoneNumber}&text=${encodeURIComponent(message)}`;
window.open(waLink, '_blank');
});
})( jQuery );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment