Skip to content

Instantly share code, notes, and snippets.

@digamber89
digamber89 / functions.php
Created Aug 6, 2020
Send Order E-mails to Zoom Hosts when Booking is Made
View functions.php
<?php
//this code is expected to be added in child theme or custom functions.php
add_action( 'woocommerce_order_status_cancelled_to_processing_notification', 'send_email_to_booking_host', 10, 2 );
add_action( 'woocommerce_order_status_failed_to_processing_notification', 'send_email_to_booking_host', 10, 2 );
add_action( 'woocommerce_order_status_on-hold_to_processing_notification', 'send_email_to_booking_host', 10, 2 );
add_action( 'woocommerce_order_status_pending_to_processing_notification', 'send_email_to_booking_host', 10, 2 );
add_action( 'woocommerce_order_status_completed_notification', 'send_email_to_booking_host', 10, 2 );
@digamber89
digamber89 / zoom-single-link.php
Created Jul 16, 2020
Shortcode to add join via browser link
View zoom-single-link.php
@digamber89
digamber89 / functions.php
Created Jul 7, 2020
Show Only Own Meetings for Users
View functions.php
<?php
add_action( 'pre_get_posts', 'show_only_authors_own_meetings' );
function show_only_authors_own_meetings( $query ) {
global $pagenow;
if ( 'edit.php' != $pagenow || ! $query->is_admin ) {
return false;
}
if ( $query->is_main_query() && $query->get( 'post_type' ) == 'zoom-meetings' ) {
@digamber89
digamber89 / main.js
Created May 3, 2019
Check if Item is in viewport -> add class if it is - remove class if it isn't
View main.js
(function ($) {
var digthisAddClassToElement = function (element) {
//cache the DOM
//use the element send through function as the dom element
var $element = $(element);
//scoped helper functions
var isInViewport = function (elem) {
var bounding = elem.getBoundingClientRect();
return (
@digamber89
digamber89 / index.html
Last active Apr 11, 2019
Multi Image Uploader Using - jQuery Dependent
View index.html
<form class="digthis-multi-upload-form" action="" method="post" enctype="multipart/form-data">
<div>
<label for="title">Title</label>
<input type="text" id="title" name="title" required>
</div>
<div>
<label for="content">Content</label>
<textarea id="content" name="content" required></textarea>
</div>
@digamber89
digamber89 / modify-functions.php
Last active Feb 21, 2019
Quick Fix Terms and Conditions
View modify-functions.php
<?php
add_action( 'woocommerce_after_checkout_validation', 'digthis_two_step_checkout_validate', 9999, 2 );
function digthis_two_step_checkout_validate( $data, $errors ) {
$step = filter_input( INPUT_POST, 'current_step' );
if ( empty( $errors->errors ) && $step == 'step-1' ) {
$errors->add( 'digthis', __( '<span id="digthis-prevent-error">Digthis Error</span>', 'woocommerce' ) );
}
@digamber89
digamber89 / enqueue.php
Created Feb 5, 2019
Multiple Upload WordPress Media
View enqueue.php
<?php
function enqueue_media_uploader()
{
wp_enqueue_media();
}
add_action("admin_enqueue_scripts", "enqueue_media_uploader");
View Lock-price-example
<?php
add_action( 'woocommerce_removed_coupon', 'cart_prices', 0 );
add_action( 'woocommerce_after_calculate_totals', 'cart_prices', 0 );
add_action( 'woocommerce_cart_loaded_from_session', 'cart_prices', 0 );
@digamber89
digamber89 / bootstrap-fix.html
Last active Nov 15, 2018
Fix for Bootstrap scrolling to div issue.
View bootstrap-fix.html
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Nav Example</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<style>
@digamber89
digamber89 / tab-fix.js
Last active Nov 5, 2018
Bootstrap 3 Remember State
View tab-fix.js
// store the currently selected tab in the hash value
$("ul.nav.panel-tabs > li > a").on("shown.bs.tab", function(e) {
var id = $(e.target).attr("href").substr(1);
window.location.hash = id;
});
// on load of the page: switch to the currently selected tab
var hash = window.location.hash;
$('ul.nav.panel-tabs a[href="' + hash + '"]').tab('show');
You can’t perform that action at this time.