View gist:25c6f8df455799639efc7795dca62045
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `wp_123456_contacts` ( | |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, | |
`full_name` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |
`email` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |
`address` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |
`province_id` char(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |
`regency_id` char(4) COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |
`district_id` char(7) COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |
`village_id` char(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |
`subject` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
View cf7-chained-select.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wpcf7_contacts_save_to_db( $cf, $result ) { | |
$submission = WPCF7_Submission::get_instance(); | |
if ( ! $submission || ! $posted_data = $submission->get_posted_data() ) { | |
return; | |
} | |
if( $result['status'] == 'mail_sent' ) { | |
global $wpdb; | |
if( !is_numeric( $posted_data['province'] ) ) $posted_data['province'] = null; |
View contact-form-whatsapp.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Contact Form WhatsApp | |
* Plugin URI: https://solusipress.com/ | |
* Description: Contact Form that send to WhatsApp Messenger | |
* Author: Yerie Piscesa | |
* Author URI: https://solusipress.com/ | |
* Text Domain: contact-form-whatsapp | |
* Version: 0.9.0 | |
*/ |
View contact-form-whatsapp.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp_enqueue_scripts', 'sp_enqueue_styles_scripts' ); | |
function sp_enqueue_styles_scripts() { | |
wp_register_script( 'sp-contact-form-wa', | |
plugin_dir_url( __FILE__ ) . '/assets/contact-form-wa.js', | |
[ 'jquery' ], '1.0.0', true | |
); | |
wp_register_style( 'sp-css-grid', plugin_dir_url( __FILE__ ) . '/assets/contact-form-wa.css', array(), '1.0.0' ); | |
} |
View contact-form-whatsapp.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_shortcode( 'sp_contact_wa', 'sp_form_contact_whatsapp' ); | |
function sp_form_contact_whatsapp( $atts ) { | |
$purpose = ''; | |
$phone = ''; | |
if( isset( $atts['purpose'] ) && $atts['purpose'] != '' ) { | |
$purpose = $atts['purpose']; | |
} | |
if( isset( $atts['phone'] ) && $atts['phone'] != '' ) { | |
$phone = $atts['phone']; |
View sc-form-wa.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="sp-form-contact"> | |
<form method="get" action=""> | |
<?php | |
$fieldset_open = false; | |
if( isset( $atts['form_title'] ) && $atts['form_title'] != '' ): ?> | |
<fieldset> | |
<?php $fieldset_open = true; ?> | |
<legend><?php echo $atts['form_title'] ?></legend> | |
<?php endif; ?> |
View contact-form-wa.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.sp-form-contact input, | |
.sp-form-contact button { | |
width: 100%; | |
padding: 10px; | |
} | |
.sp-form-contact button { | |
cursor: pointer; | |
border: 1px solid #666; | |
border-radius: 5px; | |
box-shadow: none; |
View contact-form-wa.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( function( $ ){ | |
$( document ).ready( function(){ | |
$( '#sp-form-contact-button' ).click( function( event ){ | |
event.preventDefault(); | |
var the_phone = sp_contact_form.phone; | |
var the_purpose = sp_contact_form.purpose; | |
var _name = $( '#sp-contact-name' ).val(); | |
var _city = $( '#sp-contact-city' ).val(); | |
if( _name != '' && _city != '' ) { |
View snippet-1.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'wpcf7_skip_mail', 'solusiprss_cf7_send_whatsapp', 10, 2 ); | |
add_filter( 'wpcf7_display_message', 'solusipress_cf_wa_sent_message', 10, 2 ); | |
add_action( 'wp_footer', 'solusipress_cf7_add_script_footer' ); | |
function solusiprss_cf7_send_whatsapp( $skip_mail, $contact_form ) { | |
if( $contact_form->id() == 105 ) { | |
$skip_mail = true; | |
} | |
return $skip_mail; | |
} |
View snippet-1.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_head', 'solusipress_ga_script', 0 ); | |
function solusipress_ga_script() | |
{ ?> | |
<!-- Global site tag (gtag.js) - Google Analytics --> | |
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-1"></script> | |
<script> | |
window.dataLayer = window.dataLayer || []; | |
function gtag(){dataLayer.push(arguments);} | |
gtag('js', new Date()); |
OlderNewer