Skip to content

Instantly share code, notes, and snippets.

@jchristopher
jchristopher / searchwp-customizations.php
Created March 11, 2021 14:16
Integrate SearchWP with JetSmartFilters search using JetEngine Listing Grid to display results
<?php
// Integrate SearchWP with JetSmartFilters search using
// JetEngine Listing Grid to display results.
add_action( 'pre_get_posts', function( $wp_query ) {
if (
! isset( $wp_query->query['jet_smart_filters' ] )
|| empty( $wp_query->query['s'] )
) {
return;
@aaemnnosttv
aaemnnosttv / gravity-forms-select-optgroupify.php
Created October 5, 2018 09:58
GravityForms filter to allow for grouping select choices into labelled groups using special choice options.
<?php
/**
* Filter for GravityForms to group select field choices by a special "optgroup" choice.
*
* Simply add a new choice with a value of 'optgroup' to the dropdown to start a group of options.
* All following choices will be grouped under it using its label for the group.
* Any number of groups can be created, as each optgroup choice will start a new group.
* Supports field placeholder & ungrouped options, but must be before the first group.
*
* This snippet can be added to your theme's functions.php, or a custom plugin.
@BFTrick
BFTrick / sql-command.sql
Last active April 25, 2022 14:31
A SQL command to delete all orphaned post meta data
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL