Skip to content

Instantly share code, notes, and snippets.

@Wp1stop
Wp1stop / gist:90c839214cd9db51e1fbb813d2a6761d
Created February 6, 2025 17:01
Michael C - GF control
add_action('gform_after_submission_13', 'save_company_name_to_option', 10, 2);
function save_company_name_to_option($entry, $form) {
// Get the company name from the submitted entry
$company_name = rgar($entry, '4'); // '4' is the field ID for #input_13_4
// Trim whitespace from company name
$company_name = trim($company_name);
// Check if the company name is empty
if (empty($company_name)) {
<div class="row reactiveListView"">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ): the_post(); ?>
function facetwp_filters_shortcode() {
ob_start(); // Start output buffering
?>
<!-- Include your FacetWP filters here -->
<div class="facetwp-filters">
<a class="facetwp-flyout-open">Show filters</a>
<div class="desktopmenu">
<div class="fronts"><?php echo do_shortcode('[facetwp facet="search1"]'); ?></div>
<button class="frontsubmit nexts" onclick="FWP.refresh()">Zoek</button>
function custom_filter_opleidingen_shortcode() {
ob_start(); // Start output buffering
?>
<div class="desktopmenu">
<div class="topareasearch">
<h3 class="reuseLabel___2ggDa reuseLabel___ topheadline">Filter opleidingen</h3>
<button onclick="FWP.reset()" id="ResetButtons" class="resetbuttons" type="button">Wis alle filters</button>
</div>
<div id="searchsidebar">
<span onclick="FWP.refresh()" class="reuseAutoSearchIcon___1tAQ6 reuseAutoSearchIcon___"><i class="dashicons dashicons-search"></i></span>
add_action( 'facetwp_scripts', function() {
?>
<script>
(function($) {
console.log("spin icon");
// Insert loading icon before the listing template
$('<div class="loading-icon visible"></div>').insertBefore('.facetwp-template');
function florida_counties_list_shortcode() {
// Get the site URL dynamically
$site_url = get_site_url();
$counties = [
'Alachua',
'Baker',
'Bay',
'Bradford',
'Brevard',
add_filter( 'facetwp_preload_url_vars', function( $url_vars ) {
$allowed_uris = [
'florida/alachua',
'florida/baker',
'florida/bay',
'florida/bradford',
'florida/brevard',
'florida/broward',
'florida/calhoun',
'florida/charlotte',
@Wp1stop
Wp1stop / gist:9a380bfca42cc5443fb8a0a84d8429f8
Created November 13, 2024 05:15
Calculate conv / non conv
function count_and_save_cases($post_id, $attorney_terms, $charge_terms, $plaintiff_defendant, $county_terms, $should_calculate = 0) {
// Check valid post type
if (get_post_type($post_id) != 'court-case') {
return;
}
// var_dump($attorney_terms); echo "<br>";echo "<br>";
// var_dump($charge_terms);echo "<br>";echo "<br>";
//var_dump($county_terms);echo "<br>";echo "<br>";
<table class="styled-table">
<thead>
<tr>
<th data-sort="area">Area </th>
<th data-sort="case_type">Case Type </th>
<th data-sort="plaintiff_defendant">Litigants</th>
<th data-sort="attorney">Attorney </th>
<th data-sort="experience">Experience</th>
<th data-sort="non_convs">NonConvs </th>
@Wp1stop
Wp1stop / gist:b2dd9ebe353826f8bcd8f1375c354ac7
Created October 16, 2024 14:48
Docket Manager - Order woocommerce to API
// add_action('woocommerce_thankyou', 'send_order_to_docketmanager', 10, 1);
add_action('woocommerce_new_order', 'send_order_to_docketmanager', 10, 1);
function send_order_to_docketmanager($order_id) {
// Ensure that the order ID is valid
if (!$order_id) return;
// Get the order object
$order = wc_get_order($order_id);