Skip to content

Instantly share code, notes, and snippets.

@digamber89
digamber89 / autocomplete-mods.css
Last active March 20, 2023 10:37
Hide Autocomplete Preivew
View autocomplete-mods.css
.aa-List .aa-ItemContent .aa-ItemIcon{ display: none }
.aa-List .aa-ItemContent{ grid-template-columns: 1fr }
@digamber89
digamber89 / VCZAPIBookingsMod.php
Created December 8, 2022 06:49
Zoom WC Bookings - get join links
View VCZAPIBookingsMod.php
<?php
namespace Codemanas\VczapiBookingsMod;
class VCZAPIBookingsMod {
public static $instance = null;
public static function get_instance() {
return is_null( self::$instance ) ? self::$instance = new self() : self::$instance;
}
@digamber89
digamber89 / functions.php
Created September 27, 2022 09:24
Zoom WC Appointments - Change Meeting Title
View functions.php
<?php
add_filter( 'vczapi-woocommerce-appointments-meeting-topic', 'change_appointment_topic', 10, 3 );
function change_appointment_topic( $topic, $product_id, $appointment_id ) {
$topic = 'Appointment - ' . $appointment_id;
return $topic;
}
@digamber89
digamber89 / functions.php
Created August 4, 2022 08:59
Zoom WooCommerce Appointments - add zoom link to ICS
View functions.php
<?php
function cm_20220801_add_zoom_link_to_ics( $ics_a, $appointment, $object ) {
$appointment_id = $appointment->get_id();
$meeting_details = json_decode( get_post_meta( $appointment_id, '_vczapi_woocommerce_appointments_meeting_details', true ) );
if ( empty( $meeting_details ) ) {
return $ics_a;
}
@digamber89
digamber89 / functions.php
Last active August 4, 2022 08:56
Zoom WooCommerce Appointments - Show Join via Browser only
View functions.php
<?php
function cm_220801_modified_gcal_sync( $data, $appointment ) {
remove_filter( 'woocommerce_appointments_gcal_sync', 'cm_220801_modified_gcal_sync' );
$data = '';
$appointment_id = $appointment->get_id();
$meeting_details = get_post_meta( $appointment_id, '_vczapi_woocommerce_appointments_meeting_details', true );
if ( ! empty( $meeting_details ) ) {
$meeting = json_decode( $meeting_details );
if ( is_object( $meeting ) ) {
@digamber89
digamber89 / main.js
Created April 13, 2022 09:53
Typesense - Analytics Middleware Hook
View main.js
(function($){
document.addEventListener('tsfwc_search_state_changed', function (e) {
console.log('event',e.detail);
})
//jquery
$(document).on('click','.hit-content a',function(){
console.log(window.tsfwcSearchState);
})
@digamber89
digamber89 / functions.php
Created April 8, 2022 10:03
Change Recording Date Display
View functions.php
<?php
function cm_2022_04_08_change_recording_display( $display_date_time,$start_time, $timezone){
return vczapi_dateConverter($start_time,$timezone,'F j, Y',false);
}
add_filter('vczapi_wc_recording_start_time','cm_2022_04_08_change_recording_display',10,3);
@digamber89
digamber89 / functions.php
Created April 4, 2022 08:12
Skip a certain category from being indexed as a facet
View functions.php
<?php
function cm_tsfwc_20220404_skip_product_category( $formatted_data, $raw_data, $object_id ) {
$categories = get_the_terms( $raw_data->get_id(), 'product_cat' );
$category_names = [];
if ( ! empty( $categories ) ) {
foreach ( $categories as $category ) {
$parents_ids = get_ancestors( $category->term_id, 'product_cat' );
array_unshift( $parents_ids, $category->term_id );
foreach ( $parents_ids as $parent_id ) {
//replace 29 with the id of product category you do not want to index
@digamber89
digamber89 / main.js
Created March 28, 2022 07:24
Analytics Middleware - Typesense
View main.js
(function ($) {
document.addEventListener('cmswt_search_state_changed', function (e) {
console.log('event',e.detail);
})
//jquery
$(document).on('click','.hit-content a',function(){
console.log(window.SearchWithTypesenseState);
})
@digamber89
digamber89 / wpml-compat.php
Created March 21, 2022 07:55
Add WPML Language
View wpml-compat.php
public function add_lang_facet( $formatted_data, $raw_data, $object_id ) {
//wpml compatibility check
$args = [ 'element_id' => $object_id, 'element_type' => 'post_id' ];
$language = apply_filters( 'wpml_element_language_code', null, $args );
if ( $language !== null ) {
$formatted_data['lang_attribute_filter'] = [ $language ];
}
return $formatted_data;
}