Skip to content

Instantly share code, notes, and snippets.

View AnadarProSvcs's full-sized avatar

Anadar Professional Services LLC AnadarProSvcs

  • Anadar Professional Servces LLC
View GitHub Profile
@MjHead
MjHead / jet-engine-repeater-filter-only-url.php
Last active December 15, 2023 21:49
Jet Engine, Dynamic Repeater: add new filter to allowed repeater filters
<?php
add_filter( 'jet-engine/listings/filters-list', 'jet_add_pdf_link_filter' );
/**
* Add 'get_pdf_link' to allowed filters list
*
* @param array $filters Registered filters
* @return array
*/
@MjHead
MjHead / filter-by-author-and-post-type.php
Created September 26, 2019 10:35
JetSmartFilters. Filter JetEngine listing grid by author and post type.
<?php
/**
* Register new query variables for post type and author
*
* @param array $vars Default query variables array
* @return array
*/
function my_register_filter_query_vars( $vars ) {
array_unshift( $vars, 'post_type', 'author' );
@ihslimn
ihslimn / gist:e953cf7e848e01ef06c66bfda26b42b7
Last active December 15, 2023 21:05
Format date string macro
add_filter( 'jet-engine/listings/macros-list', 'register_format_date_string_macro' );
function register_format_date_string_macro( $macros_list ) {
$macros_list['format_date'] = array(
'label' => 'Format date string',
'cb' => '_get_format_date_string',
'args' => array( 'format' => array(
'label' => 'Format',
'type' => 'text',
@Crocoblock
Crocoblock / custom-dynamic-field-callback.php
Last active November 11, 2024 23:03
JetEngine Dynamic Field add custom callback (for example, add callback that partially masks an email with * or other symbols)
<?php
//filter to add a callback to the list
add_filter( 'jet-engine/listings/allowed-callbacks', 'add_custom_dynamic_field_callbacks' );
//filter to specify which arguments will the callback have
add_filter( 'jet-engine/listing/dynamic-field/callback-args', 'add_custom_dynamic_field_callbacks_args', 0, 3 );
//filter to add controls
//controls arguments are set as in Elementor controls
@Crocoblock
Crocoblock / jsf-year-filter.php
Last active December 19, 2023 19:11
JetSmartFilters Filter by year (for checkbox/select/radio filters compatibility)
<?php
add_filter( 'jet-smart-filters/query/final-query', function( $query ) {
if ( ! isset( $query['meta_query'] ) ) {
return $query;
}
foreach ( $query['meta_query'] as $index => $meta_query_item ) {