Skip to content

Instantly share code, notes, and snippets.

View Crocoblock's full-sized avatar

Crocoblock Crocoblock

View GitHub Profile
@Crocoblock
Crocoblock / code.php
Created July 17, 2026 14:25
Jetsearch Media search
<?php
// Add Media (attachments) to JetSearch post types selector
add_filter( 'jet-search/tools/get-post-types', function( $post_types ) {
$post_types['attachment'] = 'Media';
return $post_types;
} );
// Include attachments in JetSearch queries
function jet_search_intercept_media_query( $query ) {
@Crocoblock
Crocoblock / repeater_count.php
Created July 17, 2026 14:25
Repeater Count CPT Admin Column
<?php
// ==========================================
// CONFIGURATION (Set your slugs here once)
// ==========================================
define( 'MY_CUSTOM_CPT_SLUG', 'properties' ); // Put your CPT slug here
define( 'MY_REPEATER_FIELD_SLUG', 'repeater' ); // Put your repeater meta field slug here
// ==========================================
// 1. Register a new column in the admin panel table
@Crocoblock
Crocoblock / url_contains.php
Created July 17, 2026 14:25
URL contains macro
<?php
add_action( 'jet-engine/register-macros', function() {
class URL_Contains extends \Jet_Engine_Base_Macros {
public function macros_tag() {
return 'url_contains';
}
@Crocoblock
Crocoblock / user_prop__multi_search.php
Created July 17, 2026 14:25
Search Filter by first and last name and by user ID
<?php
add_filter( 'jet-smart-filters/query/final-query', function( $query ) {
if ( empty( $query['meta_query'] ) ) {
return $query;
}
foreach ( $query['meta_query'] as $index => $meta_query_item ) {
// Check for our custom marker key (e.g., user_prop__multi_search)
if ( isset( $meta_query_item['key'] ) && false !== strpos( $meta_query_item['key'], 'user_prop__multi_search' ) ) {
$search_value = $meta_query_item['value'];
@Crocoblock
Crocoblock / code.js
Created May 14, 2026 13:54
JetFormBuilder / JetAppointments - get the number of Slots and Hours from appointment calendar
document.addEventListener("DOMContentLoaded", function () {
if (!window?.JetPlugins?.hooks) {
return;
}
const { addAction } = JetPlugins.hooks;
addAction(
"jet.fb.input.makeReactive",
"jet-form-builder/jet-appointments-booking/custom-get-count",
@Crocoblock
Crocoblock / code.php
Created March 3, 2026 14:04
JetEngine / enable autoplay for dynamic field image slider callback
<?php
add_filter( 'jet-engine/gallery/slider/atts', function( $args ) {
$args['autoplay'] = true;
$args['autoplay_speed'] = 1000;
return $args;
} );
@Crocoblock
Crocoblock / code.js
Last active March 3, 2026 08:23
JetPopup / Stop video after popup is closed
document.addEventListener('click', (e) => {
const popup = document.getElementById('jet-popup-2580');
//replce jet-popup-2580 with jet-popup-(your popup id)
if (!popup) return;
if (!e.target.closest('#jet-popup-2580 .jet-popup__close-button, #jet-popup-2580 .jet-popup__overlay')) return;
//replce jet-popup-2580 with jet-popup-(your popup id)
const iframe = popup.querySelector('iframe[src*="youtube.com/embed"]');
//replce iframe[src*="youtube.com/embed"] to your selector if you don't have youtube video
@Crocoblock
Crocoblock / code.php
Last active February 12, 2026 17:12
Dynamic Repeater filter callback - format number
<?php
class JEC_Repeater_Format_Number {
public function __construct() {
add_filter(
'jet-engine/listings/filters-list',
array( $this, 'add_callback' )
);
}
@Crocoblock
Crocoblock / code.php
Created February 4, 2026 13:37
JetEngine / Change args for gallery grid callback / Allow lightbox in Gallery Grid callback
<?php
add_filter('jet-engine/gallery/grid/args', function( $args ) {
$args['lightbox'] = true;
// default args:
// 'size' => 'full',
// 'lightbox' => false,
// 'cols_desk' => 3,
// 'cols_tablet' => 3,
@Crocoblock
Crocoblock / file1.php
Created December 18, 2025 07:24
Get min max value to range filter from query. New callback is added to the filters
<?php
use Jet_Engine\Query_Builder\Manager;
add_filter('jet-smart-filters/post-type/meta-fields-settings', 'custom_register_controls');
function custom_register_controls($fields) {
$queries = Manager::instance()->get_queries_for_options();