Skip to content

Instantly share code, notes, and snippets.

View kaskad88's full-sized avatar

Dmytro Bartoshchak kaskad88

  • Ukraine
View GitHub Profile
window.addEventListener( 'DOMContentLoaded', function() {
var $map = $( '.jet-map-listing' );
if ( ! $map.length ) {
return;
}
$map.on( 'jet-filter-custom-content-render', function( event, response ) {
add_action( 'jet-engine/listing/calendar/before', function ( $settings, $render ) {
$calendar_id = 'custom_calendar';
if ( empty( $settings['_element_id'] ) || $calendar_id !== $settings['_element_id'] ) {
return;
}
$posts_week_day = array();
$date_key = $settings['group_by_key'];
1) Add `random_users` CSS ID for Listing Grid widget https://tppr.me/7S5Xg
2) Add follow code to the functions.php file of child theme:
add_action( 'jet-engine/listing/grid/users-query-args', function( $args, $render ) {
if ( 'random_users' !== $render->get( '_element_id' ) ) {
return $args;
}
@kaskad88
kaskad88 / FIX: unserialize(): Error at offset
Created January 6, 2023 11:25
Recalculating the length of the elements in serialized array
$data = preg_replace_callback('!s:\d+:"(.*?)";!s',
function($m) {
return "s:" . strlen($m[1]) . ':"'.$m[1].'";';
}, $data
);
add_action( 'admin_enqueue_scripts', function() {
if ( wp_script_is( 'wp_social_select2_js' ) && wp_script_is( 'cx-select2' ) ) {
wp_dequeue_script( 'wp_social_select2_js' );
}
}, 99 );
add_filter( 'do_shortcode_tag', function ( $output, $tag, $attr ) {
if ( 'jet_engine' !== $tag ) {
return $output;
}
if ( empty( $attr['component'] ) || 'meta_field' !== $attr['component'] ) {
return $output;
}
add_filter( 'jet-engine/listing/grid/arrow-icons/options', function ( $options ) {
$options['my_icon'] = __( 'My icon', 'text-domain' );
return $options;
} );
add_filter( 'jet-engine/listing/grid/arrow-icon/my_icon', function ( $icon ) {
$icon = '<svg viewBox="0 0 179 179" xmlns="http://www.w3.org/2000/svg"><path transform="scale(0.1,-0.1) translate(0,-1536)" d="M909 141l102 102q19 19 19 45t-19 45l-307 307l307 307q19 19 19 45t-19 45l-102 102q-19 19 -45 19t-45 -19l-454 -454q-19 -19 -19 -45t19 -45l454 -454q19 -19 45 -19t45 19zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5
add_action( 'admin_init', function () {
if ( ! isset( $_REQUEST['page'] ) ) {
return;
}
if ( ! isset( $_REQUEST['action'] ) || 'jet-engine-op-save-settings' !== $_REQUEST['action'] ) {
return;
}
add_filter( 'jet-engine/listing/grid/posts-query-args', function( $args ) {
$args['has_password'] = false;
return $args;
} );
add_filter( 'jet-engine/listing/grid/posts-query-args', function( $args, $instance, $settings ) {
if ( ! empty( $args['post__in'] ) && ! empty( $args['post__not_in'] ) ) {
$args['post__in'] = array_diff( $args['post__in'], $args['post__not_in'] );
}
return $args;
}, 20, 3 );