Skip to content

Instantly share code, notes, and snippets.

@KimJoyFox
KimJoyFox / functions.php
Created September 14, 2018 19:52
Wordpress: using Excerpts from Advanced Custom Fields on the Search Results Page
function excerpt_function($ID, $searchTerms) {
global $wpdb;
$thisPost = get_post_meta($ID);
foreach ($thisPost as $key => $value) {
if ( false !== stripos($value[0], $searchTerms) ) {
$found = substr(strip_tags($value[0]), 0, 150);
echo $found . ' ...';
}
}
}
@BruceMcKinnon
BruceMcKinnon / gform-sections-accordion.js
Last active January 7, 2025 11:18
Collapsible Gravity Form Sections
/*
This JS creates collapsible Gravity Form sections breaks
IMPORTANT:
1 - Within the Gravity form, you must add the class collapsible to each section break.
2 - All fields within those section breaks must have the class collapsible_field
3 - You must include both the CSS and the JS
<?php
/*
Plugin Name: Add Item Meta & Order Meta for your WooComerce order
Description: A simple demo plugin on how to add add cart item meta & order item meta for your WooComerce order.
Author: Bhavik Kiri
Version: 1.0
*/
add_action( 'woocommerce_before_add_to_cart_button', 'add_fields_before_add_to_cart' );
@addyosmani
addyosmani / README.md
Last active November 24, 2025 17:23 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version